
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Convert Java String to Float Object
To convert String to Float Object, you can use a method Float.valueOf() method or you can even achieve this without using the in-built method.
Let us see both the examples.
The following is an example that converts String to Float Object using Float.valueOf() method.
Example
public class Demo { public static void main(String args[]) { Float f = Float.valueOf("30.67"); System.out.println(f); } }
Output
30.67
Let us see another example.
Example
public class Demo { public static void main(String args[]) { Float f = new Float("45.88"); System.out.println(f); } }
Output
45.88
Advertisements