1 Which method you define as the starting point of new thread in class from which in thread can be execution?
A public void start()
B public void run()
C public static void main(String args[])
D public void runnable()
注解: java有两种实现线程的方法:
1 class A继承Thread类 并且重写run方法, new A().start()启动线程
2 class A实现Runnable接口,并实现其中的run()方法。new Thread(new A()).start()启动线程。(类似于是事件监听)当然以上实现的run()方法都是无返回值,如果需要放回值,需要实现Callable接口;
答案: B
2 关于java final 的基本规则,叙述正确的是()
A final 修饰的类不可以被继承
B final 修饰的成员变量只允许赋值一次,且只能在类方法赋值
C final 修饰的局部变量即为常量,只能赋值一次
D final 修饰的方法不允许被子类覆盖
注解: final赋值:1 声明时直接赋值,2 构造函数中赋值, 3 初始化代码块时赋值,从而保证在使用之前已经被正常的赋值。
答案:ABD