Tuesday, 26 May 2009

Explanation of first program

Here is a brief explanation of the first sample program
Code
class first
{
public static void main ( String args [] )
{
System.out.println ("First Java program") ;
} // main function ends
} // class ends

class : It is one of the Java keywords.It specifies the beginning of
a new class which contains the code to execute.
main : It is a function.It is the entry point for a Java desktop application,
execution will begin with this function
public : It is one of the access specifiers in Java, a keyword
void : It is return type of function.Every function in Java must

have a valid return type.

String : It is one of the data types

args : It is a argument which stores value passed to a function

We will be giving details of all the above elements later on.