

MCQOPTIONS
Saved Bookmarks
1. |
What will be the output of the program? public class NFE { public static void main(String [] args) { String s = "42"; try { s = s.concat(".5"); /* Line 8 */ double d = Double.parseDouble(s); s = Double.toString(d); int x = (int) Math.ceil(Double.valueOf(s).doubleValue()); System.out.println(x); } catch (NumberFormatException e) { System.out.println("bad number"); } } } |
A. | 42 |
B. | 42.5 |
C. | 43 |
D. | bad number |
Answer» D. bad number | |