Java convert double to string using valueOf() method
package com.w3spoint;
public class DouleToString {
public static void main(String args[]){
double var = 551.101;
String str = Double.toString(var);
System.out.println("String is: "+str);
}
} |
package com.w3spoint; public class DouleToString {
public static void main(String args[]){
double var = 551.101;
String str = Double.toString(var);
System.out.println("String is: "+str);
}
}
Output:
Download this example.
Java convert double to string using toString() method
package com.w3spoint;
public class DouleToString {
public static void main(String args[]){
double var = 551.101;
String str = String.valueOf(var);
System.out.println("String is: "+str);
}
} |
package com.w3spoint; public class DouleToString {
public static void main(String args[]){
double var = 551.101;
String str = String.valueOf(var);
System.out.println("String is: "+str);
}
}
Output:
Download this example.