Different between parseInt() and valueOf() in java?

Well, the API for Integer.valueOf(String) does indeed say that the String is interpreted exactly as if it were given to Integer.parseInt(String). However, valueOf(String) returns a new Integer() object whereas parseInt(String) returns a primitive int. If you want to enjoy the potential caching benefits of Integer.valueOf(int), you could also use this eyesore: Integer k = Integer.valueOf(Integer.parseInt(“123”)) … Read more