0
what is the difference between parse() [which is used to parse from string to any data type] and valueOf() which also seems to be the same?
2 Answers
0
valueOf() return the string representation of the passed argument.
Example:
double d = 123456.789
System.out.println("Return Value: " + String.valueOf(d));
output:
Return Value: 123456.789
So the double became a string and went through string formatting like any other string would
0
value of() returns value in object which later on converted to primitive data types whereas,parse()
returns value directly in primitive data types