阅读程序,写出其输出结果:interfaceSpeakHello{voidspeak();}classHelloMachine{publicvoidturnOn(SpeakHellohello){hello.speak();}}publicclassE{publicstaticvoidmain(Stringargs[]){HelloMachinemachine=newHelloMachine();machine.turnOn(()->{System.out.println("welcome!");});}}
查看答案
创建一个多线程程序时可以通过实现类________, 也可以通过实现接口________
线程调度时要根据线程的优先级进行,线程的优先级可分为1 0 种,其中________代表优先级最高,_______ 代表优先级最低。
阅读下面的程序,分析代码是否能编译通过。如果能编译通过,请列出运行的结果;如果不能编译通过,请说明原因。class RunHandler {public void run() {System.out.println("run");}}public class Read01 {public static void main(String [] args) {Thread t = new Thread(new RunHandler( ));t.start( );}}
阅读下面的程序,分析代码是否能编译通过。如果能编译通过,请列出运行的结果;如果不能编译通过,请说明原因。public class Read02 extends Thread{protected void run( ) {System.out.println("this is run()" );}public static void main(String[ ] args) {Read02 a = new Read02( );a.start( );}}