Posted by : Unknown Friday, 19 June 2015



public class MainMultiple
{

   public static void main(String args[])
   {
       main(122);
       main('f');
       main("hello java");
   }

   public static void main(int i)
   {
       System.out.println("Overloaded main()"+i);
   }

   public static void main(char i)
   {
       System.out.println("Overloaded main()"+i);
   }

   public static void main(String str)
   {
       System.out.println("Overloaded main()"+str);
   }
}

Output:

Overloaded main()122 
Overloaded main()f 
Overloaded main()hello java

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Translate

Popular Post

Total Pageviews

Blog Archive

- Copyright © Learning Java Program - Powered by Blogger -