ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Why we write public static void main(String[] args)?

user-image
تم إضافة السؤال من قبل Asutosh jena Asutosh jena
تاريخ النشر: 2013/12/09
Mukesh Kumar
من قبل Mukesh Kumar , Software Engineer , Team Computers Pvt. ltd

Public:      is an acces modifier used to represent visibility which means visible to all.

Static :      is a keyword  if we declaare any method as static it is known as static method. the main method is executed by JVM so it does not requre to create object to invike the main method. so it saves memory, 

void :         is a return type of method , it means it does not return any value.

main:        represent start up of the program (execution will start allways  from main () )

String args[ ]:      is used for command line argument, it store the value pass by user at the run time, it work like array...

In the case of compiling the java code Under old (legacy ) jdk's (like1.0 to1.6) no need of writing(mentioning) main method in the java program but JDK1.7 On wards we have to encapsulate our java code in main method then only jvm considered to compile. the main method is the start point of the java code.. in old jdk's it(main) was implicitly declared but not in newer  versions........... i hope u get the point ..... :)

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟