ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
JAVA LANGUAGE:
a gentle introduction
fabio.ferraguto@gmail.com
? I n t r o du c t i o n
? G e t t i ng S t a r t e d
?Object Oriented
P a rt 1
In t rod u c ti o n
Java language: a gentle introduction
1991 OAK
January 23 1996
  version 1.0


http://www.java.com/en/javahistory
INTRODUCTION
     to
JAVA UNIVERSE
Wh a t¡¯ s J A V A ?
Language
Runtime
Environment
Standard
  Tools
Java language: a gentle introduction
F ea tu r e s
Simple
Object Oriented
Interpreted
Architecture
Neutral
Portable
Robust
Distributed
Secure
Dynamic
Concurrent
Rich
Garbage
Collector
Java
Development

Kit
JD K   Java AP I



JR E     JV M
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.
¡°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¡±
Pa rt 2
G e t ti n g S t a r te d
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. }
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
My first Java program



Step 5: Compile
          javac Hello.java
My first Java program



Step 6: Execute
          java Hello
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. }
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. }
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. }
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. }
Pa rt 3
Object Oriented
Par o gr a m m i n g
   P ar a d i gm s
Processes
Machine
EXAMPLE: ORANGE SQUEEZER




Rube Goldberg, Inventions of Professor Lucifer Butts, 1932
¡°¡­ 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
¡°¡­ 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
Things
Object Oriented
O b j e c ts ?
Class
Objects
Interface
C on c e pt s
   A nd
 F ea tu r e s
Classification
Activation
Encapsulation
Information
   Hiding
Inheritance
Composition
Polymorphism
Taxonomies
Multiple
Inheritance
Reuse

More Related Content

Java language: a gentle introduction

  • 1. JAVA LANGUAGE: a gentle introduction fabio.ferraguto@gmail.com
  • 2. ? I n t r o du c t i o n ? G e t t i ng S t a r t e d ?Object Oriented
  • 3. P a rt 1 In t rod u c ti o n
  • 6. January 23 1996 version 1.0 http://www.java.com/en/javahistory
  • 7. INTRODUCTION to JAVA UNIVERSE
  • 8. Wh a t¡¯ s J A V A ?
  • 13. F ea tu r e s
  • 24. Rich
  • 27. JD K Java AP I JR E JV M
  • 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¡±
  • 30. Pa rt 2 G e t ti n g S t a r te d
  • 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
  • 34. My first Java program Step 6: Execute java Hello
  • 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. }
  • 39. Pa rt 3 Object Oriented
  • 40. Par o gr a m m i n g P ar a d i gm s
  • 43. EXAMPLE: ORANGE SQUEEZER Rube Goldberg, Inventions of Professor Lucifer Butts, 1932
  • 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
  • 48. O b j e c ts ?
  • 49. Class
  • 52. C on c e pt s A nd F ea tu r e s
  • 56. Information Hiding
  • 62. Reuse