0
Why do classes come before main?
i have been leaning java now for 4 weeks and i understand the basics of java but for the life of me i cant seem to grasp how class works... it might sound odd but i know what its for but i dont get why it comes before main how does it work please..... ps please keep it simple ^_^ thanks
1 Odpowiedź
0
In java Class is the blueprint of all the objects
Main is a static method (Static method means only one copy of the method is formed for all objects) from where the compilation begins in Java.
As all the methods belong to a class Main also belongs to the class thereby comes after the class name
class abc
{
public static void main (String args [])
{
}//end of main
}//end of class