Java填空题
- 已知代码,最后输出结果a的值为__21____, b的值为______39____
Int a = 10;
int b = 20;
If(a++ >10 || --b<20){
a += 10;
b += 20;
} - 已知代码,最后输出结果a的值为__11____, b的值为______20____
int a = 10;
int b = 20;
if(a++ >10 && --b<20){
a += 10;
b += 20;
}
System.out.println(a);
System.out.println(b);
3. 已知代码,在空格处添加________代码块,实现打印5个KaTeX parse error: Expected '}', got 'EOF' at end of input: …m.out.println(“”);
count–;
if(count==5){ break; };
}
4.已知代码,在空格处添加___i+=2_____代码,输出1,3,5,7,9
for(int i=1;i<=10;i+=2____){
System.out.println(i);
}
5. 已知程序:输出num值为___200__输出num值为___300__
public class Test{
private static int num2 = 100;
public static void changeNum(int num){
num = 1000;
}
Public static void main(string[] args){
int num = 200;
int num2 = 300;
changeNum(num)
changeNum(num2)
System.out.println(num);
System.out.println(num2);
}
}
6. 已知程序:控制台输出的结果是____in finally 7___
public static int testTry(){
int a = 7;
try{
return a;
}catch(Exception e){
System.out.println(“in catch”);
}finally{
Syste