就会立即运行。run()方法可以产生必须退出的标志来停止一个线程。
19. 常见的应用服务器有那些(至少三个)?
BEA WebLogic Server,IBM WebSphere Application Server,Oracle9i Application Server,jBoss,Tomcat
20. 给我一个你最常见到的 runtime exception。
ArithmeticException, CannotRedoException, ArrayStoreException, BufferOverflowException, BufferUnderflowException, CMMException, CannotUndoException, DOMException, ClassCastException, EmptyStackException,
ConcurrentModificationException, IllegalMonitorStateException, IndexOutOfBoundsException, NoSuchElementException, RasterFormatException,
IllegalArgumentException, ImagingOpException,
IllegalPathStateException,
Illegal
StateException,
MissingResourceException, NullPointerException,
NegativeArraySizeException, ProviderException,
ProfileDataException,
SecurityException,
SystemException,
UndeclaredThrowableException,
UnmodifiableSetException, UnsupportedOperationException
21. 接口是否可继承接口? 抽象类是否可实现(implements)接口? 抽象类是否可继承实体类(concrete class)?
接口可以继承接口。抽象类可以实现(implements)接口,抽象类是否可继承实体类,但前提是实体类必 须有明确的构造函数。
22. List, Set, Map 是否继承自 Collection 接口?
List,Set 是,Map 不是
23. abstract 的 method 是否可同时是 static,是否可同时是 native,是否可同时是 synchronized?
都不能
24. 数组有没有 length()这个方法? String 有没有 length()这个方法?
数组没有 length()这个方法,有 length 的属性。String 有有 length()这个方法。
25. Set 里的元素是不能重复的,那么用什么方法来区分重复与否呢?
Set 里的元素是不能重复的,那么用 iterator()方法来区分重复与否。 找错,每题 5 分,三个题,是关于抽象类的,以下为要点 abstract class TestName{ private String name; private abstract boolean isStupidName(String name); //注意 abstract 方法不能是 private 的,public,protected,friendly 的都可以 public abstract void nameTest(){ //这个方法也是错的,abstract 方法不能有方法体 } } 还是找错,每题 5 分,2 个题,关于 final 的 class TestFinal{ private void finalTesting(final int i){ ++i; //这个比较明显 final 的 i 是不能变的,i++啊还是赋值啊都是错的
} } Class TestFinal{ private void finalTesting(final Testing obj){ obj.i++; //注意,这样是对的,但是如果 new 一个新的 Testing 实例赋值给 obj 又是错的 } } Class Testing{ public int i; }