单选题import java.io.PrintWriter;  class DoFormat {  public static void main(String [] args) { int x = 42; int y = 12345;  float z = 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运行时异常被抛出

单选题
import java.io.PrintWriter;  class DoFormat {  public static void main(String [] args) { int x = 42; int y = 12345;  float z = 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

运行时异常被抛出


参考解析

解析: 暂无解析

相关考题:

以下程序的运行结果为( )。 public class Sun { public static void main(String args[]) { String x="A",y="B",z="C"; for(int m=1;m<=2;m++) { x=y; y=z; z=x; } System.out.println(x+y+z); } }A.ABCB.BCAC.BCBD.CBC

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.运行时异常被抛出

执行下列代码段之后,变量z的值为______。 Public class Test8 { public static void main(String[] args) { int x=2; int y=3; int z=4; z-....= y-x--; System.out.println(z); }A.1B.2C.3D.4

下面程序段的输出结果为 package test; public class A { int x=20; static int y=6; public static void main(String args[]) { Class B b=new Class B(); b.go(10); System.out.println(”x=”+b.x); } } class Class B { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }A.x=10B.x=20C.x=6D.编译不通过

下面程序段的输出结果为 package test; public class Class A { int x=20; static int y=6; public static void main(String args[]) { Class B b=new Class B(); b.go(10); System.out.println("x"+b.x); } } class ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }A.x=10B.x-20C.x=6D.编译不通过

以下程序的输出结果为:public class test {public static void main(String args[]) {int x=1,y=1,z=1;if (x--==1}} A. x=0,y=2,z=1B. x=1,y=2,z=1C. x=0,y=1,z=1D. x=0,y=2,z=2

现有  import java.io.PrintWriter;      class  DoFormat{  public  static void main (String  []  args)  {      int x=42;  int y=12345;     float Z-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、运行时异常被抛出

现有:  class  Test4  {  public static void main (String  []  args)  {    boolean X=true;   boolean y=false;    short Z=42;    if((z++==42)  &&  (y=true))z++;    if((x=false)  ||    (++z==45))  z++;    System. out.println(¨z=”+z);     }    }  结果为:() A、  Z=42B、  z=44C、  Z= 45D、  z= 46

class Foo {  public static void main(String [] args) {  int x = 0;  int y = 4;  for(int z=0; z 〈 3; z++, x++) {  if(x 〉 1  ++y 〈 10) y++;  }  System.out.println(y);  }  }  结果是什么?()  A、6B、7C、8D、10

现有:  class Foo  {  public static void main (String  []  args)  {      int x=O;      int y=4;  for (int  z=0;  z3;  Z++;  X++)  {     if(x1++y10)    y++;    }  System. out .println (y);  }   }  结果是什么?()     A、7B、8C、10D、12

现有:  class TestMain {   static int x = 2;   static { x = 4; }   public static void main(String... args) {   int y = x + 1;   System.out.println(y);   }   }   和命令行:   java TestMain   结果为:()  A、 3B、 5C、 编译失败D、 运行时异常被抛出

class Top {  static int x = 1;  public Top(int y) { x *= 3; }  }  class Middle extends Top {  public Middle() { x += 1; }  public static void main(String [] args) {  Middle m = new Middle();  System.out.println(x);  }  }  结果为:() A、1B、2C、3D、编译失败

public class MethodOver {   private int x, y;   private float z;   public void setVar(int a, int b, float c){   x = a;   y = b;   z = c;   }   }   Which two overload the setVar method?()A、 void setVar (int a, int b, float c){  x = a;  y = b;  z = c;  }B、 public void setVar(int a, float c, int b) {  setVar(a, b, c);  }C、 public void setVar(int a, float c, int b) {  this(a, b, c);  }D、 public void setVar(int a, float b){  x = a;  z = b;  }E、 public void setVar(int ax, int by, float cz) {  x = ax;  y = by;  z = cz;  }

class TestMain {   static int x = 2;   static { x = 4; }   static public void main(String[] args) {   int y = x + 1;   System.out.println(y);  }  }   和命令行:   java TestMain   结果为:()A、 3B、 5C、 编译失败D、 运行时异常被抛出

class Test2{   public static void main(String [] args){   boolean x=true;   boolean y=false;   short z=42;   if((x==true)y=true))z++;   if((y==true||++z=44))z++;   System.out.println(“z=”+z);  }  }   结果是什么?()  A、 z=42B、 z=43C、z=44D、 z=45E、编译失败F、运行的时候有异常抛出

class Test4 {   public static void main(String [] args) {   boolean x = true;   boolean y = false;   short z = 42;   if((z++ = = 42)  (y = true)) z++;   if((x = false) || (++z = = 45)) z++;   System.out.println("z = " + z);   }   }   结果为:()  A、z = 42B、z = 44C、z = 45D、z = 46

import java.io.PrintWriter;  class DoFormat {  public static void main(String [] args) { int x = 42; int y = 12345;  float z = 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、运行时异常被抛出

单选题现有:   class TestMain {       static int x = 2;    static { x = 4; }   public static void main(String... args) {     int y = x + 1;   System.out.println(y);   }   }    和命令行:  java TestMain    结果为:()A 3B 5C 编译失败D 运行时异常被抛出

单选题现有:  class  Test4  {  public static void main (String  []  args)  {    boolean X=true;   boolean y=false;    short Z=42;    if((z++==42)  &&  (y=true))z++;    if((x=false)  ||    (++z==45))  z++;    System. out.println(¨z=”+z);     }    }  结果为:()A  Z=42B  z=44C  Z= 45D  z= 46

单选题现有:   class TestMain {      static int x = 2;  static { x = 4; }   static public void main(String[] args) {    int y = x + 1;   System.out.println(y);    }    }    和命令行:  java TestMain    结果为:()A 3B 5C 编译失败D 运行时异常被抛出

单选题现有  import java.io.PrintWriter;      class  DoFormat{  public  static void main (String  []  args)  {      int x=42;  int y=12345;     float Z-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运行时异常被抛出

单选题class Test2{   public static void main(String [] args){   boolean x=true;   boolean y=false;   short z=42;   if((x==true)y=true))z++;   if((y==true||++z=44))z++;   System.out.println(“z=”+z);  }  }   结果是什么?()A z=42B z=43Cz=44D z=45E编译失败F运行的时候有异常抛出

单选题class Test4 {   public static void main(String [] args) {   boolean x = true;   boolean y = false;   short z = 42;   if((z++ = = 42)  (y = true)) z++;   if((x = false) || (++z = = 45)) z++;   System.out.println("z = " + z);   }   }   结果为:()Az = 42Bz = 44Cz = 45Dz = 46

单选题class Foo {  public static void main(String [] args) {  int x = 0;  int y = 4;  for(int z=0; z 〈 3; z++, x++) {  if(x 〉 1  ++y 〈 10) y++;  }  System.out.println(y);  }  }  结果是什么?()A6B7C8D10

单选题现有:  class Foo  {  public static void main (String  []  args)  {      int x=O;      int y=4;  for (int  z=0;  z1++y10)    y++;    }  System. out .println (y);  }   }  结果是什么?()A7B8C10D12

单选题class Top {  static int x = 1;  public Top(int y) { x *= 3; }  }  class Middle extends Top {  public Middle() { x += 1; }  public static void main(String [] args) {  Middle m = new Middle();  System.out.println(x);  }  }  结果为:()A1B2C3D编译失败