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
Printable View
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.