Simula is considered the first object
Simula is considered the first object
programming language. The programming paradigm refers to languages that uses objects in programming. Object-
where everything is represented as an object is known as a oriented programming aims to implement real-world entities like
truly object-oriented programming language. inheritance, hiding, polymorphism in programming.
As a development environment, Java technology provides you Each Java source file must have the same name as a public
with a large suite of tools; a compiler, an interpreter, a class that it declares.
documentation generator, a class file packaging tool, and so on. Each Java source file can contain only one public class
declaration.
Java technology applications are typically general-purpose
The file extension must be .java.
programs that run on any machine where the Java Runtime
Environment (JRE) is installed. The filename is case-sensitive. Therefore, the preceding
source code must be stored in a file named NewClass.java.
There are two main deployment environments: First, the JRE Phases of Java Program
supplied by the Java 2 Software Development Kit (SDK) contains
the complete set of class files for all the Java technology
Task Tool to Use Output
Write the program Any text File w/ .java extension
editor
Compile the Java compiler File w/ .class extension (Java
program bytecodes)
Run the program Java Program Output The .class file is then interpreted by the Java interpreter that
interpreter converts the bytecodes into the machine language of the particular
The following figure describes the process of compiling and computer you are using.
executing a Java program.
Summary of the Phases of Java Program
Compilation
In Java, programs are not compiled into executable files; they are
compiled into bytecode (as discussed earlier), which the JVM
The first step in creating Java program is by writing your (Java Virtual Machine) then executes at runtime. Java source code
programs in a text editor. Examples of text editors you can use are is compiled into bytecode when we use the javac compiler. The
notepad, vi, emacs, etc. this file is stored in a disk file with the bytecode gets saved on the disk with the file extension .class.
extension .java. When the program is to be run, the bytecode is converted, using
the just-in-time (JIT) compiler. The result is machine code which
After creating and saving your Java program, compile the is then fed to the memory and is executed.
program by using the Java Compiler. The output of this process is
a file of Java bytecodes with the file extension class. Java code needs to be compiled twice in order to be executed:
A bytecode is a special machine language that can be understood 1. Java programs need to be compiled to bytecode.
by the Java Virtual Machine (JVM). The bytecode is independent 2. When the bytecode is run, it needs to be converted to
of any particular computer hardware, so any computer with a Java machine code.
interpreter can execute the compiled Java program, no matter The Java classes/bytecode are compiled to machine code and
what type of computer the program was compiled on. loaded into memory by the JVM when needed the first time. This
The Java Virtual Machine is an imaginary machine that is is different from other languages like C/C++ where programs are
implemented by emulating software on a real machine. The JVM to be compiled to machine code and linked to create an executable
provides the hardware platform specifications to which you file before it can be executed.
compile all Java Technology code. This specification enables the
Java software to be platform-independent because the compilation
is done for a generic machine known as the JVM.