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
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.
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
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?
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!
Look at the Integer class and the String class for methods for converting one type of data to the other.
u-will-neva-no (May 16th, 2011)