- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 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
To Continue Learning Please Login
Login with Google