Is this correct? The main method can be something other than void, as long as there is a main method that is void. Can a main method be anything thing as long as there is a void method?
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Yes, you can. If you by that mean if you can overload main
Note! You can have the same parameter in the header. That is your overloaded main can take String args[]. Overloaded method must have diffrent parameterlist
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
10
posted
0
To start an application, the class you type after java,i.e. java ClassName must have a method with the signature public static void main( String[] args ) or it won't start. But you may have another method named main with different parameters (overloading main) if you wish. For instance private static int main( String s ) or double main( int i ) No problem.
[This message has been edited by Marilyn deQueiroz (edited September 22, 2001).]
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt