使用while循环遍历数组arr中前4个元素的值。... int[] arr = {1,2,3,4,5}; int i = 0; while( i ______ 3){ System.out.println( arr[ ______ ] ); i______ ; }
查看答案
使用foreach语句遍历输出数组arr中的数据。... int[] arr = {1,2,3,4,5,6}; for(int a ______ ______ ){ System.out.println(______ ); }
使用switch语句完成上题中的分段函数... int a = ... switch(a>0 ? 1 : a==0 ? 2 : 3){ ______ ______ : System.out.println(______ ); ______ ; case 2______ System.out.println(0); break; case 3: System.out.println(3*a);}
使用for循环,补全代码,计算从1到100的和。... int sum=0; ______ (int i =1; i______ 100; ______ ) { sum ______ = i ; }
... int a=10, b=4; System.out.println(a/b); ...上述代码的输出结果是______