Hi All,
My question is related with converting a NUMBER TO
STRING..
Say, i have a variable of type Double as shown:
double t=42.5;
now , i make use of a static method "toString" of class Double to convert this number to a string...
String mydouble=Double.toString(t);
System.out.println(mydouble); //this statement outputs the value as : 42.5
My question is since the output is also a number, what is the meaning of 'converting a number to string' since i do have a impression of string representation...
Where as...System.out.println(t); this also outputs the same value i.e 42.5.
At the end of the day, my question is when both println statments gives the same value i.e 42.5, what is the actual role played by the method toString() method.
Thank You
:roll: :roll: