Online Java Compiler By
JavaTpoint.com
public class StringValueOfExample4 { public static void main(String[] args) { // Float, Double to String float f = 10.05f; double d = 10.02; String s1 = String.valueOf(f); String s2 = String.valueOf(d); System.out.println(s1); System.out.println(s2); } }
Output