Hey i have a quick JAVA question about integers.
The result i need is 1212 but ofcourse it gives 24. How do i get the 1212 result ?Code:int blaat = 12;
int number = blaat + blaat;
Greetings,
Frax
Printable View
Hey i have a quick JAVA question about integers.
The result i need is 1212 but ofcourse it gives 24. How do i get the 1212 result ?Code:int blaat = 12;
int number = blaat + blaat;
Greetings,
Frax
You'll need to convert it to a string first, and then I guess since you want an int value, you will need to convert it back to an integer.
Look into parseInt and toString
java Code:
int a = 12; //12 int b = Integer.parseInt(Integer.toString(a) + Integer.toString(a)); //1212