Multiple Choice Question

Quiz Guidelines

 

QID: 
545
Question: 

What can be done to get the following code to compile and run? (Assume that the options are independent of each other.)

public float parseFloat( String s ){
     float f = 0.0f;      // 1
     try{
          f = Float.valueOf( s ).floatValue();    // 2
          return f ;      // 3
     }
     catch(NumberFormatException nfe){
        f = Float.NaN ;    // 4
       return f;     // 5
     }
     finally {
         return f;     // 6
     }
     return f ;    // 7
 }

Select 4 options

A. Remove line 3, 6
B. Remove line 5
C. Remove line 5, 6 
D. Remove line 7
E. Remove line 3, 7

Q&A Set: