Java Main Features explained one-by-one in Simple words for a Beginner.
Java was released to market in 1995 with its first version JDK 1.0. From day one, it is treated as an important language used to develop many applications that are increasing everyday; the latest being Android. As on today, more than 3 billion devices are working on Java. All this popularity is due to Java’s in-built features starting from JDK 1.0. Every release (as on today, JDK 1.8) adds new features that makes programming still simple to Developer or execution performance increases.
This notes gives the main features released with JDK 1.0. Later we see every release.
All the features of Java can be put in a single line as follows.
"Platform-Independent, Portable, Simple and Familiar, Object-Oriented, Architecture Neutral, Robust, Internet-based, Implicit Memory Management, Interpreted, Distributed, Multithreaded, Dynamic, Secured, High-Performance, Free from Language".
Let us explore each feature in detail.
Many novices confuse here. They simple say, "because Java can be executed on any platform, Java is known as platform-independent language". It is totally a wrong conception, they understood in colleges. If the definition is correct, then almost I can prove every language is platform-independent. For example, you know well that C-lang can be executed on Linux and DOS (two languages). Then do you call C-lang as platform-independent? No, never. Then what is the correct meaning.
What is platform-dependent?
If a C-lang program is compiled on DOS, the generated .exe file executes only on DOS. If taken to Linux or some other OS, it never executes. That is, a C-lang program, where it is compiled, on the same OS it must be executed. This is known as platform-dependency which is very contrary to Java.
Then, what is platform-independent?
With Java, the whole scenario changes. Now, compile Java program on DOS. The generated .class file (equivalent to .exe file of C-lang) can be executed on any platform (OS), you know. That is, compile once on any platform and execute or run on any platform later as per your convenience. This is known as platform-independent, a unique feature of Java.
What made Java platform-independent? The .class file of Java contains bytecode (C-lang, .exe file contains binary code) and this bytecode makes Java platform-independent. That is, while you develop a software product in Java in your software company, just compile on the platform available in the work place. Then port it or carry the .class file to any client and execute it without bothering what platform (operating system) the client is loaded with. This is known as portability.
3. Simple and Familiar
When you look at Java code, you feel as if you have seen (or familiar with) Java earlier. It is because the Java follows the same style of variable declarations of C-lang and also method declarations, arrays and functions (in Java, C-lang functions are known as methods). Java excluded many confusing concepts of C/C++ to make programming simple to develop.
- Java does out support pointers.
- "goto" keyword is eliminated as a Programmer looses control over the control flow.
- Does not support unsigned data types. For that matter, unsigned is not a keyword of Java at all.
- Facility of operator overloading removed.
- No "# define", known as pre-processor directives.
- Multiple inheritance is not supported but supports multilevel and hierarchical.
- Unassigned variables are not assigned with garbage values.
- Memory management either creation or destruction is implicit. As memory management is implicit, Java does not support functions like malloc(), calloc(), sizeof(), delete() and free() etc.
- Does not support structures, templates and unions.
All the three OOPs concepts, encapsulation, inheritance and polymorphism, are supported by Java.
- With encapsulation, one instance variable can be given multiple values.
- Reusability of code is maximum with inheritance and composition.
- Same method gives different outputs when executed at different times is known as polymorphism and Java takes advantage of it.
5. Architecture Neutral
Java source file compilation results in an executable file known as .class file. .class file contains bytecode. Bytecode includes some square boxes, unknown and unreadable characters, some scattered English characters and this bytecoe is not in understandable format to Microprocessor. The bytecode is converted by the JVM (execution part of JDK) into binary code understood by that particular OS. The same bytecode is converted into different binary formats that can be executed by the underlying OS architecture. Java programs does not depend on the architecture of OS. Just load a compatible JDK for the OS.
Robustness means user friendliness of the language. Java does not allow the user to commit mistakes to the maximum extent.
- Unassigned variables do not take garbage values.
- Strong-type checking of variables and objects including in casting operations.
- Does not allow to give the size of the array in array initialization. In C/C++, it is optional.
- Comes with very effective exception handling mechanism added with extra features in JDK 1.7.
- Java eliminates many memory management functions.
Java, from the date of inception, supported applets. Applets are special type of Java programs with different syntax meant to be executed in Browser’s environment. Applets are used on client-side in Servlet based communication. Java supports Internet-based (using Web) programming through applets (on client-side) and Servlets (on server-side).
8. Implicit Memory Management – Garbage Collection
Java program can forget about memory management as JVM takes care of. For this reason, Java does not support memory management functions like malloc(), calloc() and sizeof() etc.
Java comes with an attractive feature called garbage collection. While a Java program is being run, the objects and variables which are not used in further part of the program (known as garbage) are removed by a special thread called garbage collector.
Java is a good supporter of networking. It supports LAN (Socket) communication through java.net package, Web communication through Servlets and JSP (Java Server Pages) and distributed communication with RMI (Remote Method Invocation) and EJB (Enterprise Java Beans).
Java supports multitasking through multithreading. A process can be divided into a number of blocks of statements. Each block can be names as a thread. That is, a process can be divided into a number of threads and each thread can be given a different task. The advantage of threads is if one thread stopped its execution by some reason, the execution can be transferred to another thread. The result is reduced Microprocessor idle time. Output will come earlier than expected.
Java Features in Detail:
For more clarity and coverage on this topic with figures and illustrations, refer Java Features – Buzz Words.
Version-wise New Features added
1. For JDK 1.4 features: JDK 1.4 (J2SE 4) Version
2. For JDK 1.5 features: (Java SE 5) Version
3. For JDK 1.6 features: JDK 1.6 Version
4. For JDK 1.7 features: JDK 1.7 Version
5. For JDK 1.8 features: JDK 1.8 Version