Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Method Overloading - Doubt

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Method Overloading - Doubt

    Hi,
    what is the output of the following code snippet and plese explain the reason for the output.
    class Demo
    {
    	void eat(Object o)
    	{
    		System.out.println("Object");
    	}
    	void eat(String a)
    	{
    		System.out.println("String");
    	}
    	public static void main(String ap[])
    	{
    		new Demo().eat(null);
    	}
    }


  2. #2
    Member DanBrown's Avatar
    Join Date
    Jan 2011
    Posts
    134
    My Mood
    Confused
    Thanks
    1
    Thanked 12 Times in 12 Posts

    Default Re: Method Overloading - Doubt

    Thanks and Regards
    Dan Brown

    Common Java Mistakes

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Method Overloading - Doubt

    Why can't you compile this and work it out for yourself? You won't learn anything unless you try. It's pretty straight forward..
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Overloading vs Overriding
    By nickypass in forum Java Theory & Questions
    Replies: 1
    Last Post: October 17th, 2010, 01:53 AM
  2. My doubt may be stupid
    By kalees in forum Object Oriented Programming
    Replies: 2
    Last Post: September 22nd, 2009, 02:38 AM
  3. JComboBox doubt
    By rajaramesh.tadi in forum AWT / Java Swing
    Replies: 0
    Last Post: August 24th, 2009, 08:18 AM
  4. Which javadoc tag is used to denote a comment for a method parameter?
    By TARUN JORA in forum Java Theory & Questions
    Replies: 2
    Last Post: May 15th, 2009, 04:30 PM
  5. Replies: 2
    Last Post: October 7th, 2008, 11:03 PM