阅读下面的程序
class Example{
public static void main(String] args) throws Exception{
int x = 0;
try{
x = div(5,2);
}catch(Exception e){
System.out.println(e);
}
System.out.println(x);
}
public static int div(int a,int b){
return a / b ;
}
}
程序的输出结果是()
选项:
A:2.5
B:2
C:2.0
D:编译失败
发布时间:2024-04-22 22:54:53