题目内容

阅读程序,写出其输出结果:class ScoreException extends Exception{int m;ScoreException(int m){this.m =m;}int getMess( ){return m;}}class Teacher{public int giveScore(int score)throws ScoreException{if(score > 100 || score<0)throw new ScoreException(score);return score;}}public class E{public static void main(String args[ ]){Teacher t = new Teacher( );int m =0,n=0;try{m = t.giveScore(100);m = t.giveScore(101);}catch(ScoreException e){n = e.getMess( );}System.out.printf("%d:%d",m,n);}}

查看答案
更多问题

阅读程序,写出其输出结果:import java.io.IOException;public class E{public static void main(String args[ ] ){int m =10;try{methodA( );m = 100;}catch(IOException e){m = 1000;}finally{m=99;}System.out.println(m);}public static void methodA( ) throws IOException{throw new IOException( );}}

阅读程序,写出其输出结果:interface Com{int get(int a,int b);}public class E{public static void main(String args[ ]){Com com=(a,b)->{return a+b;};System.out.println(com.get(12,8));}}

阅读程序,写出其输出结果:interfaceSpeakHello{voidspeak();}classHelloMachine{publicvoidturnOn(SpeakHellohello){hello.speak();}}publicclassE{publicstaticvoidmain(Stringargs[]){HelloMachinemachine=newHelloMachine();machine.turnOn(()->{System.out.println("welcome!");});}}

创建一个多线程程序时可以通过实现类________, 也可以通过实现接口________

答案查题题库