• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

In which pakage or class is the java main method

 
jeyakanth yogaratnam
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there

i want to know in which package or class is the java main method is in. Tell me the hyararchy, in which it is. And also i want to know whether the main method can be revoked in another method without the static modifier. plz reply me, for i am stuck here with this.

thanks
jeyakanth
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you write a Java program, you write the main() method. The JVM launcher program (which is written in C, not in Java) finds your class and invokes main(). Does this answer your question?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i want to know in which package or class is the java main method is in

The main method is in whichever class you put it in.


And also i want to know whether the main method can be revoked in another method without the static modifier.

You can call static methods in a non-static way (i.e. by creating an instance and calling the method on that instance), if you want to. You shouldn't though (that is, assuming by 'revoked' you mean 'invoked').
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic