If a java programme has two main methods with same signature.... wat will happen..........
$Hi/\bEr
Ganesha Kumar
Ranch Hand
Joined: May 04, 2006
Posts: 56
posted
0
You cannot have two methods with the same signature in a single Java file
Shiaber Shaam
Ranch Hand
Joined: Jun 16, 2006
Posts: 252
posted
0
then it will give compile time error.. is it?..... wat happens if i have String[] args as arg for one main() and String[] argv for another...
Chad Brown
Greenhorn
Joined: Jun 16, 2006
Posts: 1
posted
0
The simple solution is to write a program with two main methods e.g.
public class TwoMains{
public static void main(String args[]){ }
public static void main(String[] args){ }
}
Compile it and you should get a compiler error stating that main has already been defined. [ June 16, 2006: Message edited by: Chad Brown ]
Amod Mulay
Ranch Hand
Joined: Apr 06, 2006
Posts: 33
posted
0
Originally posted by Shiaber: then it will give compile time error.. is it?..... wat happens if i have String[] args as arg for one main() and String[] argv for another...
hey change the argument to string,string and see what happens..it will compile....but compiler will always look for the main(String[] df) sugniture first as it passes some default string can be empty to the main methpd for execution