下列【1】、【2】、【3】、【4】注释标注的哪行代码有错误?class E {public static void main(String args[]){int n = 0,m = 0,t = 1000;try{ m = Integer.parseInt("8888");n = Integer.parseInt("ab89"); //【1】}n =100;//【2】catch(NumberFormatException e) {}try{ m = Integer.parseInt("aaaa"); //【3】n = Integer.parseInt("8999"); //【4】}catch(NumberFormatException e) {}}}
A. 【1】
B. 【2】
C. 【3】
D. 【4】
查看答案
下列【1】、【2】、【3】、【4】注释标注的哪行代码有错误?class E {public static void main(String args[]){int n = 0,m = 0,t = 1000;try{ m = Integer.parseInt("8888"); //【1】n = Integer.parseInt("ab89"); //【2】t = Integer.parseInt("1289"); //【3】}catch(Exception e) {}//【4】catch(NumberFormatException e) {}}}
A. 【1】
B. 【2】
C. 【3】
D. 【4】
请说出下列程序的输出结果。import java.io.IOException;public class Main {public static void main(String args[]){try {methodA();}catch(IOException e){System.out.print("你好");return;}finally {System.out.println(" fine thanks");}}public static void methodA() throws IOException{throw new IOException();}}
请说出下列程序的输出结果。interface Com{public void speak();}public class Main {public static void main(String args[]) {Com p=()->{System.out.println("p是接口变量");};p.speak();}}
给出下列【代码】注释标注的代码的输出结果。abstract class A {abstract int get(int a,int b);}public class E {public static void main(String args[]) {A a=new A() {public int get(int a,int b){return a+b;}};int m = a.get(2,5);a=new A() {public int get(int a,int b){return a*b;}};int n = a.get(2,5);System.out.printf("%d:%d",m,n);//【代码】}}