What is Java?
Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let application developers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but it has fewer low-level facilities than either of them. As of 2019, Java was one of the most popular programming languages in use according to GitHub, particularly for client-server web applications, with a reported 9 million developers
A bit of history
Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle) and released in 1995 as a core component of Sun Microsystems' Java platform. The original and reference implementation Java compilers, virtual machines, and class libraries were originally released by Sun under proprietary licenses. As of May 2007, in compliance with the specifications of the Java Community Process, Sun had relicensed most of its Java technologies under the GNU General Public License. Oracle offers its own HotSpot Java Virtual Machine, however the official reference implementation is the OpenJDK JVM which is free open source software and used by most developers including the Eclipse IDE and is the default JVM for almost all Linux distributions.
The latest versions are Java 14, released in March 2020, and Java 11, a currently supported long-term support (LTS) version, released on September 25, 2018; Oracle released for the legacy Java 8 LTS the last free public update in January 2019 for commercial use, while it will otherwise still support Java 8 with public updates for personal use up to at least December 2020. Oracle (and others) highly recommend uninstalling older versions of Java because of serious risks due to unresolved security issues. Since Java 9, 10, 12 and 13 are no longer supported, Oracle advises its users to immediately transition to the latest version (currently Java 14) or an LTS release.
Most important features
The primary objective of Java programming language creation was to make it portable, simple and secure programming language. Apart from this, there are also some excellent features which play an important role in the popularity of this language. The features of Java are also known as java buzzwords.
A list of most important features of Java language is given below.
- Platform independent
- Architecture neutral
- High Performance
Java is very easy to learn, and its syntax is simple, clean and easy to understand. According to Sun, Java language is a simple programming language because:
- Java syntax is based on C++ (so easier for programmers to learn it after C++).
- Java has removed many complicated and rarely-used features, for example, explicit pointers, operator overloading, etc.
- There is no need to remove unreferenced objects because there is an Automatic Garbage Collection in Java.
Java is an object-oriented programming language. Everything in Java is an object. Object-oriented means we organize our software as a combination of different types of objects that incorporates both data and behavior.
Object-oriented programming (OOPs) is a methodology that simplifies software development and maintenance by providing some rules.
Basic concepts of OOPs are:
Java is platform independent because it is different from other languages like C, C++, etc. which are compiled into platform specific machines while Java is a write once, run anywhere language. A platform is the hardware or software environment in which a program runs.
There are two types of platforms software-based and hardware-based. Java provides a software-based platform.
The Java platform differs from most other platforms in the sense that it is a software-based platform that runs on the top of other hardware-based platforms. It has two components:
- Runtime Environment
- API(Application Programming Interface)
Java code can be run on multiple platforms, for example, Windows, Linux, Sun Solaris, Mac/OS, etc. Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform-independent code because it can be run on multiple platforms, i.e., Write Once and Run Anywhere(WORA).
Advantages of Java
- Java is Easy to write and more readable and eye catching.
- Java has a concise, cohesive set of features that makes it easy to learn and use.
- Most of the concepts are drew from C++ thus making Java learning simpler.
- Java program cannot harm other system thus making it secure.
- Java provides a secure means of creating Internet applications.
- Java provides secure way to access web applications.
- Java programs can execute in any environment for which there is a Java run-time system.(JVM)
- Java programs can be run on any platform (Linux,Window,Mac)
- Java programs can be transferred over world wide web (e.g applets)
- Java programming is object-oriented programming language.
- Like C++ java provides most of the object oriented features.
- Java is pure OOP. Language. (while C++ is semi object oriented)
- Java encourages error-free programming by being strictly typed and performing run-time checks.
- Java provides integrated support for multithreaded programming.
- Java is not tied to a specific machine or operating system architecture.
- Machine Independent i.e Java is independent of hardware .
- Java supports cross-platform code through the use of Java bytecode.
- Bytecode can be interpreted on any platform by JVM.
High performance :
- Bytecodes are highly optimized.
- JVM can executed them much faster .
- Java was designed with the distributed environment.
- Java can be transmit,run over internet.
- Java programs carry with them substantial amounts of run-time type information that is used to verify and resolve accesses to objects at run time.
Disadvantages of java
To start learning or working upon any programming language you must know its strengths and weaknesses so that you can utilize the best things out of it and avoid causing the circumstances that portray in the bad side of the language. Java has also got some drawbacks that you should know before starting over. Let's discuss the cons of using Java.
1. Java is slow and has a poor performance
Java is memory-consuming and significantly slower than native languages such as C or C++. It is also slow compared to other languages like C and C++ because each code has to be interpreted to the machine level code. This slow performance is due to the extra level of compilation and abstraction by the JVM. Moreover, sometimes the garbage collector leads in the poor performance of Java as it consumes more CPU time
2. Java provides not so attractive look and feels of the GUI
Though there are many GUI builders in Java for creating the graphical interface still they are not suitable for creating complicated UI. There are many inconsistencies while using them. There are many popular frameworks such as Swing, SWT, JavaFX, JSF for creating GUI. But they are not mature enough to develop a complex UI. Choosing one of them which can be suitable for you may require additional research.
3. Java provides no backup facility
Java mainly works on storage and not focuses on the backup of data. This is a major drawback that makes it lose the interest and ratings among users.
4. Java requires significant memory space
Java requires a significant or major amount of memory space as compared to other languages like C and C++. During the execution of garbage collection, the memory efficiency and the performance of the system may be adversely affected.
5. Verbose and Complex codes
Java codes are verbose, meaning that there are many words in it and there are many long and complex sentences that are difficult to read and understand. This can reduce the readability of the code. Java focuses on being more manageable but at the same time, it has to compromise it with the overly complex codes and long explanations for each thing.
My experience with Java
Java was the first programming language I ever learnt. I think it is a very basic language among the object-oriented ones, and a very interesting firsta approach to programming, as it has all the meanful advantages of a good programming language to set the basics, no matter which language you'll learn in the end. Furthermore, as a biomedical engineer I used Matlab a lot during my universityyears and I still use it, even if a bit less, nowadays; and Matlab is based on java language. So as an introductory language, it can be a good choice.