Hello all,
I was experimenting with wrapper classes and their methods.
String s = "15";
System.out.println(Integer.valueOf(s + 1)); //answer 16
System.out.println(Integer.parseInt(s) + 1); //answer 16
As you can see above, by running the code above, valueOf generated 16 and so did parseInt. The reason I added 1 to the answer is to know if it is really converting the string 15 to an integer because if it didn't, I would get 151 and not 16.
My question is this, whats the difference? I know that valueOf can convert an integer to a binary number but im not so sure.
Thanks all :)