then why is the answer to the following question this: C and E are correct. The invocation of parse() will return 123.456.
The invocation of
format() will throw an exception.
2. import java.text.*;
3. public class Gazillion {
4. public static void main(
String[] args) throws Exception {
5. String s = "123.456xyz";
6. NumberFormat nf = NumberFormat.getInstance();
7. System.out.println(nf.parse(s));
8. nf.setMaximumFractionDigits(2);
9. System.out.println(nf.format(s));
10. }
11. }
Which are true? (Choose all that apply.)
A. Compilation fails.
B. The output will contain "123.45 "
C. The output will contain "123.456"
D. The output will contain "123.456xyz"
E. An exception will be thrown at
runtime.