0

explain about static in the line: public static void main(String args[])

15th Jul 2016, 2:49 PM
ajit
ajit - avatar
3 odpowiedzi
+ 2
When varible or method have static modifier it means that belongs to class not object (class instance).To call that method or use static variable of class you use Class_name.static_member_name. Main is special method,when you start java program on command line java search for main method of class you want to run.have a nice day;-)
15th Jul 2016, 2:59 PM
vetarikisa
0
when you use static then it belongs to class area and hence when Java program compiles JVM searches for main() without creating object of it.
15th Jul 2016, 5:51 PM
Yatin Gaikwad
0
Java is strict oop(c++) .so main method is also in the class , as we know that for calling method object is required(eg. obj.method) but main() is in the class . first thing u should know that program is start running from main so it have to be static (static: we can call method without using object) so it can be call by JVM other it like a locker whose key is present inside it.Here class is locker and main is its key to open the class functionalities
15th Jul 2016, 6:56 PM
Apurva