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

Thread: Argument promotion

  1. #1
    Member
    Join Date
    Apr 2011
    Posts
    32
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Default Argument promotion

    Hello everyone, I know this is a lame question but would it be possible to show me some examples of argument promotion? I would like to, for example, convert an int to a string.

    Thank you XD


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    19,997
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Argument promotion

    Can you explain what you mean by "argument promotion"?
    The only thing that comes to mind is to move an argument from position 1 to position 0.

    How is converting an int to a String a promotion?

  3. #3
    Member
    Join Date
    Apr 2011
    Posts
    32
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Default Re: Argument promotion

    Because it is "promoting" an int to a String, or something that requires more bits (least thats how I interpret it). Basically what i am referring to is the opposite of casting, like having a double and reducing it to an int. I know how to do that, I was just wondering how to do the reverse process. My teacher calls it argument promotion, i guess it is not the correct term, hence why I cant find any examples lol!

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    19,997
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Argument promotion

    Look at the Integer class and the String class for methods for converting one type of data to the other.

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

    u-will-neva-no (May 16th, 2011)

Similar Threads

  1. Finding a substring from an array within a string argument
    By sitruz in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 1st, 2011, 09:33 AM
  2. HELP array cmdline argument
    By eummm in forum Collections and Generics
    Replies: 2
    Last Post: November 26th, 2010, 03:21 AM
  3. Generic method using an int[] argument
    By dubois.ford in forum Collections and Generics
    Replies: 2
    Last Post: March 18th, 2010, 07:18 AM
  4. [SOLVED] Command Line Argument Help
    By EmSaint in forum Loops & Control Statements
    Replies: 2
    Last Post: January 28th, 2010, 09:55 AM
  5. he operator / is undefined for the argument type(s) String, int
    By mtbr00x in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: September 8th, 2009, 08:34 PM