Thursday, February 18, 2010

Overloading Main Method in Java

public class Simple
{
public static void main()
{
System.out.println("My Main");
} 
public static void main(String args[])
{ 
Simple.main();
}
}  
When you run this program your runtime calls main method
with string arguments first and then calls the main method
without arguments. The output of this program will be "My Main".

0 comments: