public class Test{
public static void main(String[] args){
int num=5;
if(num<=5){
num+=2;
System.out.println(num);
}
System.out.println(num+5);
}
}
举一反三
- 请阅读下列的程序 public class Example01 { public static void main(String args) { int num = 127; byte b = num; System.out.println(b); } } 程序的运行结果是( )
- 在Java中,如下代码段的输出结果为( )。 public static void main(String []args) { int num=1; while(num<6){ System.out.print(num); if(num/2==0) continue; else num++; } }
- public static void main(String[] args) {int num=0;for (int i = 0; i <; 5; i++) {for (int j = 0; j <;=5; j++) {num++;}}System.out.println(num); }程序执行完毕以后num的值为_____________.
- 请阅读下列的程序 public class Example01 { public static void main(String args) { int num = 127; byte b = num; System.out.println(b); } } 程序的运行结果是( ) A: 编译报错 B: 编译通过,执行输出127 C: 编译通过,执行报错 D: 以上选项均不正确
- 请阅读下列的程序,程序的运行结果是() public class Example01 { public static void main(String[] args) { int num = 127; byte b = num; System.out.println(b); } } A: 编译报错 B: 编译通过,运行输出127 C: 编译通过,运行报错 D: 以上选项均不正确
内容
- 0
中国大学MOOC: 下列代码中构造方法的返回类型是()public class Village { Village () { System .out .println(“hiding in Village”) ; } public static void main( String args [ ]) { Village c =new Village ( ) ;}class Village { public static void main( String args [ ]) { Village c =new Village ( ) ; } Village () { System .out .println(“hiding in Village”) ; } }
- 1
num=float(input('输入一个数字:\n'))<br/>num=int(num)<br/>num=int((num+5)/2)<br/>num=num*2-5<br/>num=int(num%5)<br/>print(num)输入:14.5输出:______
- 2
下列代码的执行结果是 Public class Test { Public static void main(String args[]) { System.out.println(5/2); } }
- 3
public class Test{ public static void main(String[] args){ System.out.println(5/2); } }
- 4
关于属性的使用正确的是? private int num;public string Num{get{return num;};set{num=value;}}|private int num;private int Num{get{return num;}set{num=value;}}|private int num;public int Num{get{return num;}set{num=value;}}|private int num;public int Num{get{num=value;}set{return num;}}