11.classa { 12. public void process() { System.out.print(”a,”); } } 13. class b extends a { 14. public void process() throws IOException { 15. super.process(); 16. System.out.print(”b,”); 17. throw new IOException(); 18. } } 19. public static void main(String[] args) { 20. try { new b().process(); } 21. catch (IOException e) { System.out.println(”Exception”); } } What is the result?()
A、 Exception
B、 a,b,Exception
C、 Compilation fails because of an error in line 20.
D、 Compilation fails because of an error in line 14.
E、 A NullPointerException is thrown at runtime.
相关问题推荐
-
Given: 1.d is a valid, non-null Date object 2.df is a valid, non-null DateFormat object set to the current locale What outputs the current locale’s country name and the appropriate version of d’s date?()
A、Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry()+ + df.format(d));
B、Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry()+ + df.format(d));
C、Locale loc = Locale.getLocale();System.out.println(loc.getDisplayCountry()+ + df.setDateFormat(d));
D、 Locale loc = Locale.getDefault();System.out.println(loc.getDisplayCountry()+ + df.setDateFormat(d));
-
A team of programmers is reviewing a proposed API for a new utility class.After some discussion, they realize that they can reduce the number of methods in the API without losing any functionality.If they implement the new design, which two principles will they be promoting?()
ALooser coupling
BTighter coupling
CLower cohesion
DHigher cohesion
EWeaker encapsulation
FStronger encapsulation
-
int i = 0; while (true) { if(i==4) { break; } ++i; } System.out.println(“i=”+i); What is the result?()
A、 i = 0
B、 i = 3
C、 i = 4
D、 i = 5
E、 Compilation fails.
-
public static void main(String[] args) { for (int i=0;i6) break; } System.out.println(i); } What is the result?()
A、 6
B、 7
C、 10
D、 11
E、 Compilation fails.
F、 An exception is thrown at runtime.
-
What is the result?()
A、 null
B、 zero
C、 some
D、 Compilation fails.
E、 An exception is thrown at runtime.