Java is a High-Level Object Oriented Programming Language developed by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, Mike Sheridan at Sun Microsystems in 1991. Currently owned by Oracle Corporation since 2010. The language was initially named 'Oak' but was renamed 'Java' in 1995. Ironically, Java was not developed for the Internet or anything like that, it was just developed for motive of developing a platform-Independent language that could be used to create softwares to be embedded in various consumer electronic devices toasters, microwaves and remote controls.
As we know, most of the controllers of electronic devices are just different CPUs, embedded in them. And the problem was that, most of the computer programming languages were designed to be compiled for specific targets. These also could run on different CPUs, but their compilers were very expensive and time-consuming to create. This inspired James Gosling and others to create a language independent of platform, that could produce a code that could run on a wide variety of CPUs, under differing Environments.
Why to learn Java?
As we read above, Java is a very High-Level Programming Language but with the spice of simplicity. Its really one of the easiest most popular computer languages, with a large number of applications and uses. From Software Developers to Students, it is in a great demand. Java is actually the soul and the heart of all kinds of applications.
It is used in App Development whether it is Android, Desktop or Mobile App Development, Java is dominant in every sphere and even many frameworks like Hadoop, HBase, Accumulo and Elastic Search are Java-based and use Java. It is a very interesting language and also has vast support of libraries, tools and frameworks that are based on Java.
Main Features of Java
- Object-Oriented : Java embodies the Modern Object-Oriented programming philosophy. That means in Java, everything is an object, except the primitive data-types. Java can also be easily extended since it is based on the Object model. All the concepts of OOPs like Encapsulation, Abstraction, Inheritance and Polymorphism are supported in Java.
- Simple : Java has a concise, cohesive set of features that makes it easy to use and learn.
- Secure : It provides a secure means of creating internet applications. Since any file downloaded from the internet may have viruses in it, but using a Java-compatible Web browser, Java-applets can be downloaded from anywhere, without the fear of any type of virus. The authentication techniques are based on public key encryption.
- Platform Independent : Java programs can be compiled on any type of platform, whether it is Mac, Linux or Windows, it only requires a JVM(Java Virtual Machine) to compile the code. Unlike C and C++, Java is not compiled into a platform specific machine, but rather to a platform independent byte code, that can be easily interpreted by the JVM. This makes Java highly Portable.
- High-performance : The Java Byte code is highly optimised for the speed of execution. It is designed in such a way that the Byte code could be easily translated into native machine code for very high performance by using a just-in-time compiler.
- Robust : Java was built with the idea to encourage error-free programming by being strictly typed and performing run-time checks. Creating robust programs was given the top priority while developing Java.
- Multi-threaded : Java also supports multi-threaded programming. It helps in creating interactive and networked programs capable of doing multiple tasks at a time.
- Distributed : Java was designed keeping in mind the distributed environment of the internet, because it can handle TCP/IP protocols all on its own. Infact accessing a resource using a URL is not much different form accessing a file. This allows objects on two different systems to execute methods and procedures remotely. Java revived these interfaces in a package called Remote Method Invocation(RMI).
- Dynamic : A substantial amount of run-time information is carried by the Java programs with them, which can be used to verify and resolve access to the objects at the run-time. This makes it possible to dynamically link code in a safe and expedient manner.
- Open Source
What is a JVM?
Java Virtual Machine (JVM) is a virtual machine that allows a computer to run Java programs as well as programs written in other languages that are also compiled to Java Byte code. It also manages and optimizes program memory. It acts a run-time engine to run Java applications, by converting the byte code into native machine languages. It is not platform independent like Java. Special implementations are required for different platforms.
What is a Byte Code?
Java Byte Code is the instruction set for the Java Virtual Machine and the main reason by Java is platform-independent. Whenever we compile a Java program, a file with an extension .class is generated which is actually what we call byte code. It is a non-runnable code, that cannot be run by the CPU itself as is the case with machine code, which can be directly executed by the CPU. An interpreter is required to execute the Byte code, this job of interpreter is done by the JVM.
Relation with C/C++
Java is directly related to C and C++. The syntax of Java is inherited from C and its Object Model from C++. Due to the similarity in syntax with C, the newbie programmers can easily shift to Java, without facing any difficulties and vice-versa for Java programmers to shift to C/C++.
From the starting of the Modern Programming Era with C and C++, Java Developers have made Java capable to successfully inherited the features and the rich heritage, enabling it to provide a powerful, logical consistent programming environment that takes the best of the past and adds new features required in today's competitive world. It is grounded by the needs and experiences of the people who devised it. Making it a professional programming language, even with more capabilities than in C/C++.
Applications of Java
- Desktop GUI Applications
- Embedded Systems
- Mobile Applications
- Web Applications
- Web and Application Servers
- Cloud-based Applications
- Gaming Applications
- Business Applications
- Enterprise Applications