相关考题

单项选择题 public class TestApp{   public static void main(String[] args){  try{   int i = 0;   int j = 1 / i;   String myname=null;   if(myname.length()>2)   System.out.print(“1”);   }catch(NullPointerException e){   System.out.print(“2”);  }   catch(Exception e){   System.out.print(“3”);   }      }        }   上述程序运行后的输出是哪项?()

单项选择题 public class TestApp{   public static void main(String[] args){   try{   String myname = null;   if(myname.length()>2)   System.out.print(“1”);   }catch(NullPointerException e){   System.out.print(“2”);  }  }  }   上述程序运行后的输出是哪项?()

单项选择题 现有:   1. class Book {   2. private final void read() { System.out.print("book "); }   3. }   4. class Page extends Book {   5. public static void main(String [] args) {   6. // insert code here   7. }   8. private final void read() { System.out.print("page "); }   9. }   和如下三个代码片段( x, y, z ):   x. // just a comment   y. new Page().read();  z. new Book().read();   分别插入到第6行,有几个允许代码通过编译并可以运行且无异常?()