Sunday, January 5, 2014

JAVA: Difference between Integer.valueOf and Integer.parseInt

In Java, to convert a String into an integer you can use either

Integer.valueOf(String) 

or

Integer.parseInt(String). 

But what is the difference between them? Well 

Integer.valueOf(String) gives as result an Integer object.

Integer.parseInt(String) gives the primitive Java type int

No comments:

Post a Comment

Your comment will be visible after approval.