Why do classes come before main? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

13th Jul 2017, 12:31 PM
D_Stark
D_Stark - avatar
1 Answer
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
13th Jul 2017, 1:01 PM
Nirmal Kumar Bhakat
Nirmal Kumar Bhakat - avatar