
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert a String to a float type Number
Use the parseFloat() method in Java to convert a String to a float type.
Let’s say we have the following string.
String str = "111.8";
Now, the Float.parseFloat() method will convert it to a float type number.
float floatVal = Float.parseFloat(str);
The following is the complete example with output.
Example
public class Demo { public static void main(String args[]) { String str = "111.8"; float floatVal = Float.parseFloat(str); System.out.println("Float: "+floatVal); } }
Output
Float: 111.8
- Related Questions & Answers
- Java Program to convert float to String
- Convert a String to a double type number in Java
- Java Program to convert Java String to Float Object
- Java Program to convert a Primitive Type Value to a String
- Java program to convert float decimal to Octal number
- Java Program to convert string value to float using Float.valueOf()
- Convert from float to String in Java
- Convert from String to float in Java
- C Program to convert a number to a string
- Java Program to convert a string into a numeric primitive type using Integer.valueOf()
- Convert string to a number in Java
- How to convert a CLOB type to String in Java?
- Python program to convert float decimal to octal number
- Convert a String to a byte number in Java
- Convert a String to a short number in Java
Advertisements