Start with java



Simple Java program structure


Class A

{

public static void main(String args[])

{

//your code

}



Above I given very simple structure of java program

By using this you can write your first program “hello”


Class hello
{

public static void main(String args[])

{
System.out.println(“Hello”);

}
}

Class hello

It is the first line of our program.java is object oriented language that’s why everything must be placed inside the class

Every class begins with opening  brace “{” and end with   “}” .

public static void main(String args[]);

Don’t think about this line copy it same as shown.
I will tell u in brief about this in our next post.

System.out.println(“Hellow”);

This is use for print out put
In our above program we will get out put “Hello”

No comments:

Post a Comment