A Quick Look Into JAVA
JAVA is a general-purpose object-oriented programming language, designed to have as few implementation dependencies as possible. Also referred as “write one, run anywhere” (WORA) which means that a program which has WORA capability can run anywhere regardless of the platform or machine its being run on, e.g. a java program compiled on a desktop computer with windows can also run on a mainframe with UNIX without the need to be recompiled.
Developed in the early 90’s by James Gosling at Sun Microsystems(now owned by Oracle), Java was originally designed to be used on digital devices such as mobile phones. However, with the release of version 1.0 in 1996, its main focus had shifted to the internet.
There has been many updates since version 1.0 over the years, and java has evolved as a successful programming language to be used both on and off the internet.
There are two distributions of the current implementation
- Java Runtime Environment (JRE) – intended for the end users and contains parts of Java SE required to run java programs
- Java Development Kit (JDK) – intended for developers and contains development tools like Java debugger, jar, compiler.
Syntax
Let us look what a basic java program contains and write a basic java program
- Objects – an object has state and behavior. Methods display an object’s behavior, while the state of an object is stored in fields(variables).
- Class – class in java are templates that are used to create and define objects, object methods and data types.
- Methods – methods are basically behaviors, all the logic is written in these methods.
Now lets write a basic java program
public class FirstJavaProgram {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
This is a simple/basic java program to print “Hello World!” on the console.