Name the method which helps you …

CBSE, JEE, NEET, CUET
Question Bank, Mock Tests, Exam Papers
NCERT Solutions, Sample Papers, Notes, Videos
Posted by Radhika Saini 8 years, 9 months ago
- 1 answers
 
Related Questions
Posted by Parth Chaudhary 1 year, 8 months ago
- 2 answers
 
Posted by Simran Batra 1 year, 4 months ago
- 0 answers
 
Posted by Akib Chowdhury 1 year, 5 months ago
- 1 answers
 
Posted by Arifa Meharun 1 year, 3 months ago
- 0 answers
 
Posted by Prapti Dubey 1 year, 5 months ago
- 0 answers
 
Posted by Yashika Kakkar 1 year, 5 months ago
- 1 answers
 
Posted by Siya Vishwakarma 1 year, 6 months ago
- 1 answers
 
Posted by Martina Sangchoju 1 year, 9 months ago
- 2 answers
 

myCBSEguide
Trusted by 1 Crore+ Students

Test Generator
Create papers online. It's FREE.

CUET Mock Tests
75,000+ questions to practice only on myCBSEguide app
 myCBSEguide
          
Imran Khan 8 years, 8 months ago
Converting a String to a float requires that you first convert the String to a Float object, then convert the Float object to a float data type (Float is an object, while float is a primitive data type).
An example of a simple program that performs this conversion is shown below:
<pre> public class StringToFloat { public static void main (String[] args) { // String s = "fred"; // do this if you want an exception String s = "100.00"; try { float f = Float.valueOf(s.trim()).floatValue(); System.out.println("float f = " + f); } catch (NumberFormatException nfe) { System.out.println("NumberFormatException: " + nfe.getMessage()); } } } </pre>Other notes
1Thank You