1.如果是NoSuchFieldException或者说是它的子类的例外可以出现在catch内!2。p1->p2->f3.transient表示短暂的,当在进行类持久化时,也就是serialize时,对于有些
密码之类的变量,为了安全,有时不想持久化,这时就可以使用transient放在
变量的前面就行了!
3.volatile,在scjp中不考的!

解决方案 »

  1.   

    p2好像不会继承f的Layout :(
    只有同类的对象才会继承?
      

  2.   

    1。不懂题意,对于try{}catch{}语句,只要知道try catch finally执行原理及顺序即可。catch里面写要catch的异常,
    2.p1,p2,f之间没有继承关系,它们有自己的default Layout.考试中只会考各种布局是如何安置部件的。
    3。同flylijian(飞入绝境) (  )
      

  3.   

    to tednugent(Ted) 你说的对,p2不会继承f的Layout。在一般情况下component 按照parent container的layout属性排列布局,如果component自定义(explicit)有自己的Layout属性,它还是会按照自己parent container 的Layout属性排列布局。你的第一个问题,也是概念的问题,我同意xiaobi_liang(淡泊以明志,宁静以致远...)的说法。
      

  4.   

    第一题可能是我没说清楚题目,原题:
    What will happen when you compile and run the following code?public class MyClass 

        public static void main(String args[]) 
            { 
                   System.out.println("Before Try"); 
                  
    try 
                   { 
                   } 
                   catch(Throwable th) 
                   { 
                        System.out.println("Inside Catch"); 
                   }
     
                   System.out.println("After Try"); 
             } 
    }
    答案:
    Before Try
    After Try为什么不会发出:"Exception is never thrown in body of corresponding try statement" 的错误?try块中不可能抛出例外呀而改成catch(IOException e){}就会产生“exception java.io.IOException is never thrown in body of corresponding try statement”的警告?