Java is class-oriented object oriented programming languages which primarily used for application development that can run on any OS and have robust security features. Sun Microsystems developed it and later became Oracle; it was released in 1995. Java is designed by the adage ‘write once, run anywhere’ (WORA); nevertheless, compiled byte code will run on any platform that supports JVM. In this tutorial we will provide you an introduction to java programming language with example.
Core features of Java
Object-oriented: The basic unit in Java is the class and a class defines an object which is a set of data field or attribute along with a set of actions called method. This makes the code more re-usable and easier to maintain and it also makes the code less bloated and more mod- ule.
Platform Independence: Java has the privileged position during compilation into bytecode and its further execution in the JVM, which affects the unity of the program execution and no fragmentation.
Robust: The features like exception handling, automatic garbage collection and strong types amongst others reduce the possibility of run-time errors and thus improve on the reliability of the code.
Secure: Java also provides measures for security like Bytecode checks, magnificence loaders, security managers for the attack of malicious codes.
Simple: Part of Java’s implementation is easily readable and minimal compared to some other languages making it easier for programmers of special backgrounds.
High performance: Java is not assuredly fast as low level languages but it has regular performance through just-in-time compilation and optimized bytecode.
Multi-threaded: Java aids in multithreading, meaning that several tasks can run at once within an application, a couple of responsibilities.
Example
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Explanation
This code creates a class named ‘Main’ by using the keyword and placing it outside of the class definition to make it a public class meaning it is the container of the program. By the way, within this class, the ‘main’ method plays the role of the program entry point. It has been underlined as static void, which means that it does not return any value, although it has one parameter – string array ‘args’. The basic feature is to display the text “Hello, World!”
Comments