Introduction to Java:
Java is a high level, class based and object-oriented programming language. It was released by Sun microsystems in the year 1995 by James Gosling. It is platform Independent follows logic “ write once ,run anywhere” i.e., the compiled code can run on all platforms which supports java. Java is used to built desktop application, web application, android application, Enterprise application.
Features of Java:
Simple: Java is easy to learn by removing all difficulties like pointers, operator overloading as we see in C++ or any other programming languages.
Portable: This is platform independent, which means that any application written on one platform can be easily executed in another platform.
Object-oriented: Everything is considered to be an object which possess some state, behavior and all operations are performed using these objects.
Secured: All code is converted in bytecode after compilation, which is not readable by a human. And java does not supports explicit pointers and uses exception handling to handle the exceptions , By this java is secure.
Dynamic: It supports dynamic memory allocation due to which memory wastage is reduced and performance of the application is increased.
Distributed: Java is distributed because users can create distributed applications in java. RMI and EJB are used to create distributed applications.
Robust: Java has a strong memory management system. It helps to eliminate errors and the code is checked during compile and runtime.
Interpreted: Java uses Just-In-Time (JIT) interpreter along with the compiler for the program execution.
Multithreaded: The main advantage of multi- threading is that it does not occupy memory for each thread . It shares a common memory area. Threads are important for multi-media, web applications.
High performance: With the use of bytecode it is easy to translate into native machine code. With the use of JIT compilers , it enables high performance.
3 Components of java:
There are three components.
JVM (Java Virtual Machine):
It is an abstract machine, physically does not exists. bytecode can be executed in run time environment. It is a platform dependent.
- Loads code.
- Verifies code.
- Executes code.
- Provides run time environment.
JRE (Java Runtime Environment):
- JRE means runtime environment in which bytecode is executed. It implements the JVM and it consists of class libraries and other files that JVM uses . It is a software package that contains what is required to run a program. It’s an implementation of JVM which physically exists.
JDK ( Java Development Kit):
It is the tool necessary to:
- Package java programs.
The JDK includes JRE which contains tools for programmers. Along with JRE, it consists of interpreter, a compiler(javac), an archiver(jar), and other tools. In short it contains JRE+ development tools.