This document provides an introduction to the Java programming language. It discusses key concepts such as the Java Virtual Machine (JVM), the Java Runtime Environment (JRE), and the Java Development Kit (JDK). It also introduces object-oriented programming concepts like classes, objects, interfaces, encapsulation, inheritance, and polymorphism. The document includes examples of a simple "Hello World" Java program and provides steps for writing, compiling, and running a Java file. It discusses some of the features of Java like being simple, object-oriented, interpreted, architecture neutral, portable, robust, distributed, secure, dynamic, concurrent, and having automatic memory management via garbage collection.
28. JRE JDK
(Java Runtime environment) (Java Development Toolkit)
It is an implementation of the Java It is a bundle of software that you can
Virtual Machine* which actually use to develop Java based
executes Java programs. applications.
Java Run Time Environment is a plug- Java Development Kit is needed for
in needed for running java programs. developing java applications.
JRE is smaller than JDK so it needs JDK needs more Disk space as it
less Disk space. contains JRE along with various
development tools.
JRE can be downloaded/supported JDK can be downloaded/supported
freely from freely from
java.com java.sun.com
It includes JVM , Core libraries and It includes JRE, set of API classes,
other additional components to run Java compiler, Webstart and
applications and applets written in additional files needed to write Java
Java. applets and applications.
29. ¡°An imaginary machine that is
Virtual Machine
implemented by emulating it in
software on a real machine.
Code for the java virtual machine
is stored in .class files, each on
which contains code for at most
one public class.¡±
da ¡°The Java Virtual Machine Specification¡±
31. My first Java program
1. public class Hello {
2. // entry point
3. public static void main(String[] args){
4. System.out.println("Hello World!");
5. }
6. }
32. My first Java program
Step 1: Open a text editor
Step 2: Open a console (prompt dos/unix)
Step 3: Write the code in text editor
Step 4: Save as Hello.java
33. My first Java program
Step 5: Compile
javac Hello.java
35. My first Java program
1. public class Hello {
2. // entry point
3. public static void main(String[] args){
4. System.out.println("Hello World!");
5. }
6. }
36. My first Java program
1. public class Hello {
2. // entry point
3. public static void main(String[] args){
4. System.out.println("Hello World!");
5. }
6. }
37. My first Java program
1. public class Hello {
2. // entry point
3. public static void main(String[] args){
4. System.out.println("Hello World!");
5. }
6. }
38. My first Java program
1. public class Hello {
2. // entry point
3. public static void main(String[] args){
4. System.out.println("Hello World!");
5. }
6. }
44. ¡°¡ nel progettare una sequenza codificata, quello che
bisogna avere innanzitutto in mente non ¨¨ l¡¯apparenza
originale della sequenza, ma piuttosto il suo
funzionamento e il suo continuo cambiamento mentre il
processo che essa controlla procede nel suo corso. ¡
? dunque consigliabile incominciare la progettazione
dalla fine, e cio¨¨ progettare per prima cosa il corso del
processo e la relazione delle sue fasi successive con il
codice che cambia, e quindi estrarre la sequenza
codificata come operazione successiva.¡±
Goldstine & Von Neumann, 1947
45. ¡°¡ Questi ¡°linguaggi di Von-Neumann¡± creano
dei blocchi stradali mentali enormi e non
necessari nel pensare i programmi e nel
creare le combinazioni di alto livello richieste
da una metodologia di programmazione
veramente potente. ¡¡±
John Backus, 1978