PDA

View Full Version : beginners java questions[3chapters first]



leonidassavvides
09-14-2008, 07:10 PM
public class xxxXXX
{
public static void main()
{

}
}



"static" what means ?
the class xxxXXX how is executed in this java program(file) , I mean the whole java program contained ? A class that has method "main" differs from a normal class ?

Twey
09-14-2008, 09:31 PM
'static' means that the method belongs to the class itself, not to the instances of the class (i.e. you do xxxXXX.main(foo) rather than (new xxxXXX()).main(foo)).

You run the application like you would any other: java <classname>. A class with a public static void main(String[]) differs from other classes only in that it can be used as an entry-point into your application.

It's conventional to begin class names with a capital letter.