Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Overview of Java
History of Java
Java Standards
Editions of Java
JDK and IDE
Characteristics of Java
Sample Java Program
Creating, Compiling and Executing Java Program
Java Runtime Environment (JRE) and Java Virtual Machine
(JVM)
Overview of Java
Computer languages have strict rules of usage. Java standards are defined by
• Borland Jbuilder
• Microsoft Visual J++
• Net Beans
• Eclipse
• BlueJ
We will be using JDK1.8
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented Java is inherently object-oriented. Object-oriented
• Java Is Distributed programming provides great flexibility, modularity,
clarity, and reusability through encapsulation,
• Java Is Interpreted
inheritance, and polymorphism
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed Distributed computing involves several computers
• Java Is Interpreted working together on a network. Java is designed to
• Java Is Robust make distributed computing easy.
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted You need an interpreter to run Java programs. The
• Java Is Robust programs are compiled into the Java Virtual
• Java Is Secure Machine code called bytecode. The bytecode is
machine-independent and can run on any machine
• Java Is Architecture-Neutral
that has a Java interpreter, which is part of the Java
• Java Is Portable Virtual Machine (JVM).
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust Java compilers can detect many problems that
• Java Is Secure would first show up at execution time in other
languages.
• Java Is Architecture-Neutral
• Java Is Portable Java has eliminated certain types of error-prone
• Java's Performance programming constructs found in other languages.
• Java Is Multithreaded
• Java Is Dynamic Java has a runtime exception-handling feature to
provide programming support for robustness.
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure Java implements several security mechanisms to
• Java Is Architecture-Neutral protect your system against harm caused by stray
programs.
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral Write once, run anywhere
• Java Is Portable
• Java's Performance With a Java Virtual Machine (JVM), you can write
one program that will run on any platform.
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable Because Java is architecture neutral, Java programs
• Java's Performance are portable. They can be run on any platform
• Java Is Multithreaded without being recompiled.
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance Java’s performance Because Java is architecture
• Java Is Multithreaded neutral, Java programs are portable. They can be
run on any platform without being recompiled.
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded Multithread programming is smoothly integrated in
• Java Is Dynamic Java, whereas in other languages you have to call
procedures specific to the operating system to
enable multithreading.
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable Java was designed to adapt to an evolving
• Java's Performance environment. New code can be loaded on the fly
• Java Is Multithreaded without recompilation. There is no need for
developers to create, and for users to install, major
• Java Is Dynamic
new software versions. New features can be
incorporated transparently as needed.
Understanding JDK, JRE and JVM
Understanding JDK & JRE
JDK
JDK is an acronym for Java Development Kit.
It physically exists. It contains JRE and development tools.
JRE
JRE is an acronym for Java Runtime Environment.
It is the implementation of JVM and used to provide runtime environment.
It contains set of libraries and other files that JVM uses at runtime.
Understanding JVM
JVM (Java Virtual Machine) is an abstract machine.
It is a specification that provides runtime environment in which java byte code can be
executed.
JVMs are available for many hardware and software platforms.
The source code (program) written in java is saved as a file with .java
extension.
The java compiler “javac” compiles the source code and produces the platform
independent intermediate code called BYTE CODE. It is a highly optimized set
of instructions designed to be executed by the JVM.
How Java is Platform-independent?
The byte code is not native to any platform because java compiler doesn’t
interact with the local platform while generating byte code.
It means that the Byte code generated on Windows is same as the byte code
generated on Linux for the same java code.
The Byte code generated by the compiler would be saved as a file with .class
extension. As it is not generated for any platform, can’t be directly executed on
any CPU.
Java Libraries, Middle-ware, and Database options
java.lang
java.util
java.sql
java.io
java.nio
java.awt
javax.swing
Sample Java Program
• Use any text editor or IDE to create and edit a Java source-code file
• The source file must end with the extension .java and must have exactly
the same name as the public class name Welcome.java
• Compile the .java file into java byte code file (Java bytecode is the
instruction set of the Java virtual machine)
javac Welcome.java
If there are no syntax errors, the compiler generates a bytecode file
with .class extension