101.方法中throw RuntimeException或error不必在方法中声明
这和throw checked Exception不一样
102.Catch(X x)can catch subclass of X
103.RuntimeException is the immediate superclass of NullPointException
104.rethrow 异常时,方法中也要声明抛出异常。
105.不可以在方法内部定义static变量,static方法不可以被继承
106.Assert抛出的异常Exception in thread “main” java.lang.AssertionError:true
其中true是expression2 的值
107.Catch(Exception e){} try中不抛出异常,仍然可以编译通过
108.两个
break不可以连着,因为有一个
break reach不到,所以compile error
109.Class A{
Void A(){}
} 这不是错误,只是一个普通的方法罢了。
110.Int[] score={3,4,5,} (right)
Int [] aa=new int[3]{1,2,3} (wrong)
111.如果在方法中声明了一个对象,返回的是对该对象的引用,则无法判断该对象是否可以回收
112.Condition compilation is used to allow tested class to run at full speed.
113.the default constructor has the same access as its class
114. do not use assertions to validate arguments to a public method and command-line
Do not use assert expressions that can cause side effect
Do use assertions to check for cases that you know are never even supposed to happen
115.abstract class have constructors and those constructors are always called when a concrete subclass is initiated.
116.An interface has no constructor, because it is not part of an objects inheritance tree.
117.private的构造函数只是不能被继承而已,不会因此compile error
118.boolean b=Boolean.TRUE (wrong)
119.public synchronized void run(){} (right,并且也覆盖run方法)
120.String s=”abc”; Object o=(Object)o;
s.equals(o) =true o.equals(s)=true 因为自动绑定
String s=new String(“true”);
Boolean b=new Boolean(true)
s.equals(b) =false