aspose file tools*
The moose likes Beginning Java and the fly likes Accessing the main method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Accessing the main method " Watch "Accessing the main method " New topic
Author

Accessing the main method

Naufal Mohamed
Greenhorn

Joined: Jan 14, 2003
Posts: 5
is it possible to access a class's main method from another class and can a main method return a value?
if possible could anybody tell me how this is implemented.
thank you
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
why not just give it a try, remember main is static method so u can just call it using class name. and dont forget to pass String[] as argument. And it will return void.


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Naufal!
is it possible to access a class's main method from another class
Yes.
can a main method return a value?
No.
could anybody tell me how this is implemented.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Accessing the main method