What is Java? 

Java is simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, multi threaded and dynamic language.

Advantages of Java

• Java is a true object-oriented language. Almost everything in Java is an object.All program code and data reside within objects and classes.  The object model inJava is simple and easy to extend. 
• Portable: Java programs can be moved from one computer system to another anywhere and anytime.   
• Platform-Independent
• Write once, run anywhere: As java programs are compiled into machine-independent byte codes, they run consistently on any java platform.
• Write robust and reliable programs
• Build an application on almost any platform and run that application on any other supported platform without having to recompiling your code.
• Distribute your applications over a network in a secure fashion 

Applications of Java

• Java is designed as a distributed language for creating applications on network.
• It has the ability to share both the data and programs. 
• Java applications are open and access remote objects on Internet as easily as they can do in a local system.
• It supports multithreading.
• Multithreading means handling multiple tasks simultaneously. We need not wait for the application to finish one task before beginning another.  
• Java and Internet
• Java and World Wide Web
• WWW is an open-ended information retrieval system designed to be used in the Internet’s distributed environment.  Java can be used in distributed environment. Both Java and Web share the common technology. 

First Java Program

 Save the file as FirstJavaPgm.java
 Compile the program using javac (javac compiler JDK tool) 
C:\javac FirstJavaPgm.java
 Run the program using java (java interpreter JDK tool) 
C:\java FirstJavaPgm

The output is:
Welcome to the world of java programming 

Description of the above program:

The first line “//file name must be FirstJavaPgm” is a comment line.  The compiler ignores the line. Comment line can be indicated by  
The second line class FirstJavaPgm  

Declares a class, which is an object-oriented construct.  “FirstJavaPgm” is user defined class name. A java program may contain multiple class definitions. Classes are the primary and essential element of a Java program.  These classes are used to map the objects of real world problems.   

Opening Brace 
 
Every class definition in Java begins with an opening brace “{“ and ends with a matching closing brace “}” appearing in the last line in the example. This indicates the beginning and closing of any block. 

The Main Line 

public static void main(string args[ ]) 
 
• The main method must be declared as public, since it must be called by outside of its class 
• The keyword static allows main() to be called without having to instantiate a particular instance of the class.  This is necessary since main() is called by the Java interpreter before any objects are made. 
• The key word void tells the compiler that main() does not return any value. 
• The argument to main() is an array of string objects.  Whether the command line arguments are used in this program or not, but they have to be there because they hold the arguments invoked on the command line. 

The Output line

The only essential statement in the program is  “System.out.println(“Welcome to the world of Java programming”);

This is similar to the printf() statement of C.  Since Java is a true Object oriented programming language every method is a part of an object.  The println method is a member of the class out object, which is a static data member of System class.  This line prints the string as Welcome to the world of Java Programming on the screen.