Search This Blog

If you have any problem or question please write in the comments. We will try to solve and send you the solution. Not just that we will also post your problems solution on our blog.

Sunday, 5 June 2011

How to write a simple java program

Java is very powerful and secure language with multiple features. Writing a java program is a very simple method. Here is the syntax of a simple java program

class  name
{
public static void main (String arg[])
{

// body.

}
}

here “name” is the name of class and you will save your program with this name. You can write anny name of your class but not reserve words of java. The function “public static void main (String arg[])” is java’s main function.

Remember you must save your program like this:

"class-name.java"

otherwise it will not execute/compile.

Note: 
         java is case sensitive language and you have to write the main function as it is written above.
“body” means the code of your java program.

No comments:

Post a Comment