Why makers of Java didn't give the main() function Public and Static as an inbuilt functionality?

Interface Methods have inbuilt functionality of being abstract and public (ie we do not neccessarily have to declare them Abstract / Public)
Similiarily Interface Variables are Public, Static and Final!!

Obviously there are certain reasons for this!!

My doubt is why dint the makers of Java give the main() function Public and Static as an inbuilt functionality? I mean main() is the Starting point of program execution and it must be accessible from everywhere , thats why we use static public, i know!!
but Since Everytime we use main(), if it has to be static and public, then why dint they makers of java give it an in-built functionality??

Replies

  • Anoop Kumar
    Anoop Kumar
    main method is a class member and when program start running JVM looks for standard definition public static void main(String []args) .
    if main() would only used for starting point.. then what happen if developer wants to create his/her own method name main().


    Basic idea of interface is contract between client and developer that following name of methods will be there and developer will implement by its own
    while variable are client chosen which obviously should not be changed that is why static,final.
  • Aadesh
    Aadesh
    is it possible to create more than 1 main() in a java program?
  • Anoop Kumar
    Anoop Kumar
    why not try yourself 😀

You are reading an archived discussion.

Related Posts

can any one suggest me the best book for metal cutting and machine tools...
Need of the hour for India is strong leadership,unfortunately present corps of Politicians (so called leaders) motives are self-interest rather than development which always REMAINS in back-seat.Each and every scheme...
plz tell me about SAP (Systems Applications and Products in Data Processing)...which one MODULE is better...
Hello, I am Rashmi, studying B.E in Computer Science( from Belgaum, Karnataka, India). I am in 7th sem now. we have to do a project this year , n our...
Physical system modelling of common rail` hight pressure fuel oil system for anologic PID construction.