importjava.io.PrintWriter;classDoFormat{publicstaticvoidmain(String[]args){intx=42;inty=12345;floatz=7;System.out.format(-%4d-,x);System.out.format(-%4d-,y);System.out.format(-%4.1d-,z);}}结果为:()A.编译失败B.-42--1234--7.0-C.-42--1234--7.0-D.运行时异常被抛出

importjava.io.PrintWriter;classDoFormat{publicstaticvoidmain(String[]args){intx=42;inty=12345;floatz=7;System.out.format("-%4d-",x);System.out.format("-%4d-",y);System.out.format("-%4.1d-",z);}}结果为:()

A.编译失败

B.-42--1234--7.0-

C.-42--1234--7.0-

D.运行时异常被抛出


相关考题:

现有importjava.io.PrintWriter;classDoFormat{publicstaticvoidmain(String[]args){intx=42;inty=12345;floatZ-7;System.out.format(一%4d-,X);System.out.format(-%4d-,y);System.out.format(-%4.ld-,z);}}结果为:()A.编译失败B.-42--1234--7.0-C.-42--1234--7.0-D.-42--12345--7.0-E.运行时异常被抛出

现有:classFoo{publicstaticvoidmain(String[]args){intx=O;inty=4;for(intz=0;z3;Z++;X++){if(x1++y10)y++;}System.out.println(y);}}结果是什么?() A.7B.8C.10D.12

publicclassIfTest(publicstaticvoidmain(string[]args){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?() A.Theoutputis“Equal”B.Theoutputin“NotEqual”C.Anerroratline5causescompilationtofall.D.Theprogramexecutesbutdoesnotprintamessage.

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 ex38 { public static void main(String[] args) { int x=12; int m=11; int y=13; int temp=x>y?x:y; temp=temp>m?temp:m; System.out.println (temp); } }A.1B.12C.13D.11

运行下面程序时,会产生什么异常?() 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