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 5 of 5

Thread: method overloading problems

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default method overloading problems

    hello frnds i have some problem in this code can you solve this my issue and pls tell me whats the issue in this progrma


    public class App {

    public void print(int i) {
    System.out.println("int value==" + i);

    }

    public void print(float f) {
    System.out.println("float value==" + f);
    }

    public static void main(String[] args) {
    App pd; // create aobject
    pd.print(5);
    pd.print(20.03); //here error is occured
    }
    }


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: method overloading problems

    When you get an error post the full and exact message.
    pd.print(20.03);  // < that value is a double not a float
    Improving the world one idiot at a time!

  3. #3
    Junior Member
    Join Date
    Sep 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: method overloading problems

    so what is the float value

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: method overloading problems

    Google how to change a double to a float.
    Improving the world one idiot at a time!

  5. The Following User Says Thank You to Junky For This Useful Post:

    shravan (October 12th, 2013)

  6. #5
    Junior Member
    Join Date
    Sep 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: method overloading problems

    ok frnds i got the solution thnks for your reply..
    thnks,........

Similar Threads

  1. Overloading a method
    By Lahoree in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 15th, 2013, 11:46 AM
  2. overloading an equals method
    By hannah87 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 15th, 2013, 02:54 PM
  3. Abstract method vs overloading
    By tcstcs in forum Java Theory & Questions
    Replies: 4
    Last Post: January 10th, 2013, 02:58 AM
  4. Overloading Method
    By Tohtekcop in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 16th, 2012, 02:28 PM
  5. Method Overloading - Doubt
    By vidya lakshman in forum Java Theory & Questions
    Replies: 2
    Last Post: January 31st, 2011, 09:32 AM

Tags for this Thread