I am not able to understand the clear difference between xxxValue(),ParseXxx() and valueOf() methods. Any one can explain me these with simple example? Thanks
To use the first one xxxValue() method you need to have an object created already. For example:
Integer i = new Integer(15); System.out.println(i.intValue()); System.out.println(i.byteValue()); System.out.println(i.doubleValue());
it will print out the int, byte, double primitive values of the Integer object i.
The following two: parseXxx() and valueOf() are static methods. So that means you can call them by using Integer.parseXxx() or Integer.valueOf().
And the difference betweent the two is that parseXxx() returns primitive but valueOf()returns object. They generally takes String as input. For example:
int a = Integer.parseInt("15"); System.out.println(a);
Integer b = Integer.valueOf("15"); System.out.println(b);