Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

Java Program to convert float to String



The valueOf() method is used in Java to convert float to string.

Let’s say we have the following float value.

float val = 10.18465F;

Converting the above float value to string.

String.valueOf(val);

Example

 Live Demo

public class Demo {
   public static void main(String[] args) {
      float val = 98.18465F;
      // converting float to String
      String str = String.valueOf(val);
      System.out.println("String: "+str);
   }
}

Output

String: 98.18465
Updated on: 2020-06-26T06:30:12+05:30

281 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements