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?

9th Oct 2016, 2:22 PM
Abhinav Maurya
Abhinav Maurya - avatar
2 Respostas
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
9th Oct 2016, 4:55 PM
Flo
0
value of() returns value in object which later on converted to primitive data types whereas,parse() returns value directly in primitive data types
10th Oct 2016, 7:10 AM
Mihir