publicclassX{2.publicstaticvoidmain(String[]args){3.int[]a=newint[1]4.modify(a);5.System.out.printIn(a[0]);6.}7.8.publicstaticvoidmodify(int[]a){9.a[0]++;10.}11.}Whatistheresult?() A.Theprogramrunsandprints“0”B.Theprogramrunsandprints“1”C.Theprogramrunsbutabortswithanexception.D.Anerror“possibleundefinedvariable”atline4causescompilationtofail.E.Anerror“possibleundefinedvariable”atline9causescompilationtofail.
publicclassX{2.publicstaticvoidmain(String[]args){3.int[]a=newint[1]4.modify(a);5.System.out.printIn(a[0]);6.}7.8.publicstaticvoidmodify(int[]a){9.a[0]++;10.}11.}Whatistheresult?()
A.Theprogramrunsandprints“0”
B.Theprogramrunsandprints“1”
C.Theprogramrunsbutabortswithanexception.
D.Anerror“possibleundefinedvariable”atline4causescompilationtofail.
E.Anerror“possibleundefinedvariable”atline9causescompilationtofail.
相关考题:
Given1.publicclassFoo{2.publicstaticvoidmain(String[]args)}3.try{return;}4.finally{Syste.out.printIn(Finally”);}5.}6.}Whatistheresult()? A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Finally”.C.Thecodecomiles.Butanexceptionisthrownatruntime.D.Thecodewillnotcompilebecausethecatchblockismissing.
publicclassForBar{2.publicstaticvoidmain(String[]args){3.inti=0,j=5;4.tp:for(;;){5.i++;6.for(;;)7.if(i--j)breaktp;8.}9.system.out.printIn(i=”+i+,j=+j);10.}11.}Whatistheresult?() A.Theprogramrunsandprints“i=1,j=0”B.Theprogramrunsandprints“i=1,j=4”C.Theprogramrunsandprints“i=3,j=4”D.Theprogramrunsandprints“i=3,j=0”E.Anerroratline4causescompilationtofail.F.Anerroratline7causescompilationtofail.
运行下面程序时,会产生什么异常?() public class X7_1_5 { public static void main(String[] args) { int[] z = {1,2,3,4}; int p = z[4]; int x = 0; int y = p/x; } }A.ArithmeticExceptionB.ArrayIndexOutOfBoundsExceptionC.NumberFormatExceptionD.IOException
运行下面程序时,会产生什么异常?() public class X7_1_5 { public static void main(String[] args) { int[] z = {1,2,3,4}; int p = z[4]; int x = 0; int y = 5/x; } }A.ArithmeticExceptionB.NumberFormatExceptionC.ArrayIndexOutOfBoundsExceptionD.IOException
运行下面程序时,会产生什么异常?() public class X7_1_5 { public static void main(String[] args) { int[] z = {1,2,3,4}; int p = z[4]; int x = 0; int y = 5/x; } }A.NumberFormatExceptionB.ArrayIndexOutOfBoundsExceptionC.IOExceptionD.ArithmeticException
28、运行下面程序时,会产生什么异常?() public class X7_1_5 { public static void main(String[] args) { int[] z = {1,2,3,4}; int p = z[4]; int x = 0; int y = p/x; } } A.ArithmeticExceptionB.ArrayIndexOutOfBoundsExceptionC.NumberFormatExceptionD.IOException
在C#中,下列代码的运行结果是()。 public class Test { static void Main(String[] args) { int[] num = new int[5]{1,3,2,0,0}; Array.Reverse(num); foreach(int i in num) { Console.Write(i); } } }
5、在C#中,下列代码的运行结果是()。 public class Test { static void Main(String[] args) { int[] num = new int[5]{1,3,2,0,0}; Array.Reverse(num); foreach(int i in num) { Console.Write(i); } } }
14、下面程序段执行后的输出是 。 public class Array____Ex { public static void main(String[] args) { int[] a=new int[1]; modify(a); System.out.println("a[0]="+a[0]); } public static void modify(int[] a) { a[0]++; } }