Java OCA OCP Practice Question 2948

Question

What is the result of the following program when run in the United States?

import java.util.Locale; 
import java.text.NumberFormat; 
 
public class MyParser { 
  public static void main(String [] args) { 
     NumberFormat nf = NumberFormat.getInstance(Locale.FRANCE); 
     String value = "444,33"; 
     System.out.println(nf.parse(value)); 
  } /*  w w  w . ja v a 2 s.c o  m*/
} 
  • A. 444.33
  • B. 444,33
  • C. There is one compiler error.
  • D. There is more than one compiler error.
  • E. An exception is thrown at runtime.


C.

Note

The parse methods throw a checked ParseException.

Checked exceptions must be caught.




PreviousNext

Related