OOP - Lecture 3 Intro To Java
OOP - Lecture 3 Intro To Java
Lecture 3
g
[email protected]
What is Java Programming Language?
• Robust
• No explicit pointers, strong memory management, automatic garbage collection,
exception handling
• Multithreaded
• It is multithreaded as it can perform several tasks simultaneously within a program.
• Distributed
• It helps in developing applications on networks that can contribute to both data and
application functionality.
• Dynamic
• Java is a dynamic language which means it can link new Java class libraries, Java
objects, and Java methods dynamically.
Advantages Of Java
• Java is object-oriented, which helps reduce the complexity and
create reusable and efficient code.
• Security. Java provides guarantees for security such as Security-
related APIs and Byte-code verification.
• Java is considered to be a simple language.
• Java is platform-independent, which means it can be moved from
one computer system to another.
• It is multithreaded as it can perform several tasks simultaneously
within a program.
• Memory allocation.
• Java is robust as compilers can detect errors.
Applications Of Java
JVM
• The Java Runtime Environment (JRE) provides the libraries, the Java
Virtual Machine and other components to run applets and applications
written in the Java Programming Language. JRE does not contain tools
and utilities such as compilers or debuggers for developing applets and
applications
JDK
• The JDK stands for Java Development Kit used for developing Java
applets and apps. It is basically a software development
environment.
• Loads code
• Verifies code
• Executes code
• Provides the runtime environment
JDK (cont…)
The JDK is a superset of the JRE, and contains everything that is in the
JRE, plus tools such as the compilers and debuggers necessary for
developing applets and applications.
Difference Between JDK, JRE, and JVM
Java compiling and interpreting process
• In Java, programs are not compiled into executable files; they are compiled
into bytecode using javac compiler.
• The JVM (Java Virtual Machine) then executes these bytcodes at runtime.
•
• The bytecode gets saved on the disk with the file extension .class.
• When the program is to be run, the bytecode is converted into machine code
using (JIT) compiler. The result is then fed to the memory and is executed.
STEP 2