They have developed a new language named OaK in 1993. But OaK name is already registered. So, they have decided to rename it as JAVA (Good quality of Tea is coming from Java Islands). The Sun Microsystems has released Java in June 1995 on the occasion of Sun World Conference.
Features of Java:
1. Simple - Java is a simple programming language. Learning and practicing Java is easy because of its resemblance with C and C++. The difficult concepts in C++ have been eliminated in Java.
Java = C++ - Complexities. For example pointer concept has been eliminated in Java.
Question: Why pointers are eliminated in Java?
Pointers lead to confusion for a programmer. Pointers may crash a program. Using pointer virus and hacking programs can be written.
1. Object oriented - Unlike C++, Java is a purely object oriented programming language. Java programs uses objects and classes.
Object: An object is anything that exists in this real world. An object has properties and behaviors (actions).
In our program variables are used to represent properties. Actions are represented by methods. i.e.; An object contains variables and methods. i.e.; Objects need memory. JVM will allocate the memory required for objects.
Class: A class is a model or blue print for creating objects. Class doesn?t exist physically, it is only our idea. i.e.; A class contains the definition for variables and methods of its objects.
Below table depicts some class names and objects.
|Flower||Lilli, Jasmine, Lotus|
|Book||NoteBook, TextBook, RefBook|
|Actor||Chiranjeevi, Kamal Hasan, Rajani|
|Actress||Radha, Anushka, Tamnna, Sneha Ullal|
|Shirt||T-Shirt, S-Sleve, Glasour|
|Sweet||Jilebi, Coa, Kalakanda|
C++ is not purely an object oriented programming language because without creating an object or a class we can write a C++ program. Whereas, without creating at least one class we can't write a program. So, Java is said to be a purely object oriented programming language.
3. Distributed: - Java is a distributed technology. Information is distributed on various computers on a network. Using Java, we can write programs which capture information and distribute ii to clients.
4. Robust: - Java programs will not crash easily because of its exception handling and its memory management features. Memory management was handled by JVM> i.e.; allocation and de-allocation of memory handled by JVM.
Memory Allocation: JVM's class loader sub system will allocate required memory for a program.
Memory de-allocation: JVM's garbage collector will free the allocated memory. Garbage collector will check the memory between every time interval and it used Mark and Sweep algorithm to de-allocate the memory for unused variables and objects.
Exception handling: Exception means a run time error. In Java we can handle the exceptions.
5. Secure: - Java enables the construction of virus free and tamper free systems.
6. Architecture neutral: - Java's byte code is not machine dependent. It can be run on any machine with any processor and with any O/S.
7. Portable: - A program yielding the same result on any computer is said to be portable. Java program give same results on all machines. Everything is clearly defined in Java specification and nothing is left to O/S.
8. Interpreted: - Java programs are compiled to generate the byte code. This byte code can be downloaded and interpreted by the interpreter in JVM.
9. High performance: - Along with interpreter, there will be JIT (Just in time) compiler which enhances the speed of execution.
10. Multi threaded: - We can create different processing in Java, called "threads". This is an essential feature to design server side program.
11. Dynamic: - We can develop programs in Java, which dynamically interact with the user on internet (Eg: Applets)