网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
针对下面代码,下列说法正确的是()。public class TestClass{ public static void main(String arr[]) { int i=6/0; System.out.println(arr[1]); } }
A.编译时正确,运行时将产生错误
B.编译时将产生错误
C.输出零
D.输出空
参考答案和解析
C
更多 “针对下面代码,下列说法正确的是()。public class TestClass{ public static void main(String arr[]) { int i=6/0; System.out.println(arr[1]); } }A.编译时正确,运行时将产生错误B.编译时将产生错误C.输出零D.输出空” 相关考题
考题
以下代码的运行结果是______。public class exl5{public static void main(String args []){int i = 5;do{i--;if(i > 2)continue;}while(i < 0);System.out.println(i);}}
考题
阅读下面的程序: public class Person{ int arr[ ]=Hew int[10]; public static void main(String args[ ]){ System.out.println(arr[1]); } } 正确的说法是______。A.编译时将产生错误B.编译时正确,运行时将产生错误C.输出为0D.输出为空
考题
下面代码段的输出结果为( )。 public class Test { public static void main(String sss[]) { int i=0xFFFFFFFl; int j=~i; } }A.0B.1C.14D.-15
考题
阅读下列代码后 public class Person{ int arr[]=new int[10]; public static void main(String args[]){ System.out.println(arr[1]); } } 正确的说法是( )。A.编译时将产生错误B.编译时正确,运行时将产生错误C.输出零D.输出空
考题
执行下面的程序段,输出结果为______。public class Q{public static void main(String argvr)){int anar[]=new int[5];System.out.println(anar[0]);}}
考题
阅读下列代码Public class Person{Static int arr[ ] = new int (10);Public static void main (String args ) {System.out.println(arr[9]);}}该代码运行的结果是A )编译时将产生错误B )编译时正确,运行时将产生错误C )输出 0D )输出空
考题
下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出
考题
阅读下面代码 public class Person { static int arr[]=new int[10]; public static void main(String args) { System.out.println(arr[9]); } } 该代码的运行结果是A.编译时将产生错误B.编译时正确,运行时将产生错误C.输出零D.输出空
考题
给出下列的程序,其叙述正确的是public class Man { static int arr[]= new int [10]; public static void main (String a []){ System.out.println(arr[1]); }}A.编译时将发生错误B.编译时正确但是运行时出错C.输出为0D.输出为null
考题
下面代码的运行结果是 public class Test{ public static void main(String args[]){ for(int i=0; i<3;i++){ if(i<2) continue; System.out.println(i); } } }A.0B.1C.2D.3
考题
下面程序代码运行结果为( )。 import java.awt.*; public class Test { public static void main (String args[]) { String s1="a+b+c"; String s2="+"; int i=s1.lastIndexOf (s2); System.out.println(i); } }A.0B.1C.2D.3
考题
interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}
考题
阅读下列代码: public class Person{ static int arr[]=new int[10]; public static void main(String args){ System.out.println{arr[9]); } } 该代码的运行结果是( )。A.编译时将产生错误B.编译时正确,运行时将产生错误C.输出零D.输出空
考题
给出下列的程序,其叙述正确的是 ( ) public class Man { static int arr[]=new int[10]; public static void mam(String a[]) { System.out.println(arr[1]); { }A.编译时将发生错误B.编译时正确但是运行时出错C.输出为0D.输出为null
考题
阅读下列代码后 public class Person{ int art[]=new int[10]; public static void main(String args[]){ System.out.println(arr[1]); } } 正确的说法是( )。A.编译时将产生错误B.编译时正确,运行时将产生错误C.输出零D.输出空
考题
下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.
考题
本题的功能是计算二维数组arr[][]={{34,21,45,67,20},{23,10,3,45,76},{22,3,79,56,50}}中的最小值,并输出。public class javal{public static void main(String[]args){int arr[][]={{34,21,45,67,20),{23,10,3,45,76},{22,3,79,56,50}};int i=0:intj=0;int min=arr[0][0];while(i<;3){while( ){if(arr[i][j]<;min)min=arr[i][j];j++;};;}System.out.println("The min:"+min);}}
考题
本题将数组中arr[]={5,6,3,7,9,1}的各个元素按下标的逆序输出。public class javal{public static void main(String[]args){int arr[]={5,6,3,7,9,1};;n= ;while(n>;=O){System.OUt.print(arr[n]+"");;}}}
考题
本题的功能是用冒泡法对数组元素arr[]={30,1,-9,70)进行从小到大排列。冒泡法排序是比较相邻的两个元素的大小,然后把小的元素交换到前面。public class javal{public static void main(String[]args){int i,j;int arr[]={30,1,-9,70);int n= ;for(i=0;i<;n-1;i++){for(j=i+1;j<;n;j++){if(arr[i]>;arr[j]){int temp=arr[i];;;}}}for(i=0;i<;n;i++)System.out.print(arr[i]+"");}}
考题
给出下面的程序: public class ex49 { static int arr[] = new int[10]; public static void main(String args [] ) { System.out.println (art [1] ); } } ______叙述是正确的。A.编译时将发生错误B.输出为 nullC.输出为0D.编译时正确但是运行时出错
考题
给出下面代码:public class Person{static int arr[] = new int[10];public static void main(String a[]) {System.out.println(arr[1]);}}以下那个说法正确?
A. 编译时将产生错误;B. 编译时正确,运行时将产生错误;C. 输出0;D. 输出null。
考题
下面程序的输出结果是() public class Test{ public static void main(String[] args){ String s = “abc dsf ghi”; String[] arr = s.split(“/s”); System.out.println(arr.length); } }A、 编译报错B、 2C、 1D、 3
考题
class Super { public int i = 0; public Super(String text) { i = 1; } } public class Sub extends Super { public Sub(String text) { i = 2; } public static void main(String args[]) { Sub sub = new Sub(“Hello”); System.out.println(sub.i); } } What is the result?() A、 0B、 1C、 2D、 Compilation fails.
考题
Given the following code: public class Person{ int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1]); } } Which statement is correct?() A、 When compilation some error will occur.B、 It is correct when compilation but will cause error when running.C、 The output is zero.D、 The output is null.
考题
Given the following code: public class Person{ static int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1];) } } Which statement is correct?() A、 When compilation some error will occur.B、 It is correct when compilation but will cause error when running.C、 The output is zero.D、 The output is null.
考题
单选题Given the following code: public class Person{ static int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1];) } } Which statement is correct?()A
When compilation some error will occur.B
It is correct when compilation but will cause error when running.C
The output is zero.D
The output is null.
考题
单选题Given the following code: public class Person{ int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1]); } } Which statement is correct?()A
When compilation some error will occur.B
It is correct when compilation but will cause error when running.C
The output is zero.D
The output is null.
考题
单选题下面程序的输出结果是() public class Test{ public static void main(String[] args){ String s = “abc dsf ghi”; String[] arr = s.split(“/s”); System.out.println(arr.length); } }A
编译报错B
2C
1D
3
热门标签
最新试卷