0% found this document useful (0 votes)
5 views2 pages

My Java Notes

Uploaded by

chakkushah1116
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
0% found this document useful (0 votes)
5 views2 pages

My Java Notes

Uploaded by

chakkushah1116
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 2

What is Java?

Developed by Sun Microsystems in 1995, Java is a highly popular, object-oriented


programming language. This platform independent programming language is utilized
for Android development, web development, artificial intelligence, cloud
applications, and much more.

// A Java program to print "Hello World"


public class Java {
public static void main(String args[])
{
System.out.println("Hello World");
}
}

Java is a class-based, object-oriented programming language that is designed to


have as few implementation dependencies as possible. It is intended to let
application developers write once, and run anywhere (WORA).

Java was designed with core principles: simplicity, robustness, security, high
performance, portability, multi-threading, and dynamic interpretation.

Features of Java

Java is Object Oriented. However, it is not considered as pure object-oriented as


it provides support for primitive data types (like int, char, etc)

The Java codes are first compiled into byte code (machine-independent code). Then
the byte code runs on Java Virtual Machine (JVM) regardless of the underlying
architecture.

Java syntax is similar to C/C++. But Java does not provide low-level programming
functionalities like pointers. Also, Java codes are always written in the form of
classes and objects.

Java is used in all kinds of applications like Mobile Applications (Android is


Java-based), desktop applications, web applications, client-server applications,
enterprise applications, and many more.

For example, non-primitives are always references in Java. So we cannot pass large
objects (like we can do in C++) to functions, we always pass references in Java.
One more example, since there are no pointers, bad memory access is also not
possible.

When compared with Python, Java kind of fits between C++ and Python. The programs
are written in Java typically run faster than corresponding Python programs and
slower than C++. Like C++, Java does static type checking, but Python does not.

Execution of the java Program =>

The Java compiler (javac) converts the source code into bytecode, which is stored
in a .class file. This bytecode is platform-independent and can be executed on any
machine with a JVM.

JDK=JRE+Development Tools
if you are only interested in running Java programs on your machine then you can
easily do it using Java Runtime Environment. However, if you would like to develop
a Java-based software application then along with JRE you may need some additional
necessary tools, which is called JDK.

Execution Engine

Execution engine executes the “.class” (bytecode). It reads the byte-code line by
line, uses data and information present in various memory area and executes
instructions. It can be classified into three parts:

Interpreter: It interprets the bytecode line by line and then executes. The
disadvantage here is that when one method is called multiple times, every time
interpretation is required.
Just-In-Time Compiler(JIT) : It is used to increase the efficiency of an
interpreter. It compiles the entire bytecode and changes it to native code so
whenever the interpreter sees repeated method calls, JIT provides direct native
code for that part so re-interpretation is not required, thus efficiency is
improved.
Garbage Collector: It destroys un-referenced objects. For more on Garbage
Collector, refer Garbage Collector.

You might also like