28、下列程序输出结果是什么? public class E { public static void main(String[] args) { int x=1,y=6; while(y-->0) { x--; } System.out.print("x="+x+",y="+y); } }

28、下列程序输出结果是什么? public class E { public static void main(String[] args) { int x=1,y=6; while(y-->0) { x--; } System.out.print("x="+x+",y="+y); } }


参考答案和解析
8

相关考题:

若有如下程序:public class Test {public static void main (String[] args) {int x=20;if (x>10) System.out.print(x-=5);if (x>5) System.out.print(x--);}}则程序运行后的输出结果是【 】。

以下程序的运行结果为( )。 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

下面程序的输出为( )。 public class Test { public static void main (String args[]) { int x,y; x=1; y=2; System.out.println("The output is"+x+y); } }A.The output is xyB.The output is 3C.The output is 12D.The output is x=1 y=2

执行下面程序后输出的正确结果是 public class Test{ public static void main(String args[]){ byte x=3,y=4; long r=80L; System.out.print(r/y); System.out.print(","); System.out.print(x/y); } }A.20.0,1B.20.0,1.0C.20,0D.20,1.0

下面程序的输出结果为( )。 public class Test { public static void main (String args[]) { String X="ABCD"; String Y="EFG"; X=X.substring (X.length()-Y.length()); System.out.println(X); } }A.ABCB.BCDC.EFGD.ABCDEFG

下面程序段的输出结果为 package test; public class ClassA { int x=20; static int y=6; public static void main(String args[]) { ClassB b=new ClassB(); 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=10,y=9; boolean b=true; System.out.println(x<y||!b); } }A.真B.假C.1D.0

设x和y均为int型变量,则执行下面的循环后,y值为( )。 public class Sun { public static void main(String args[ ]) { int x, y; for (y=1, x=1; y<=50; y++) { if(x>=10) break; if (x%2==1) { x+=5; continue; } x-=3; } System.out.println (y); } }A.2B.4C.6D.8

下列语句输出结果为( )。 public class test { public static void main(String args[ ]) { int x=10,y=8; boolean b=true; System.out.println(x>0&&x<y||b); } }A.真B.假C.1D.0

执行下面程序,显示的结果为( )。 public class Test { public static void main (String args[]) { Test t=newTest(); System.out.println (Loverload ("2","3")); } int overload (intx,int y) {return x+y;} String overload (String x,Stnng y){return x+y;} }A.2B.3C.5D.23

设有如下程序: public class Sun { public static void main(String args[ ]) { int x,y; x=4; y=0; if(Math.pow(x,2)==16) y=x; if(Math.pow(x,2)15) y=1/x; if(Math.pow(x,2)>15) y=(int)Math.pow(x,2)+1; System.out.println(y); } } 程序的运行结果是( )。A.4B.17C.18D.0.25

下面程序段的输出结果为( )。 package test; public class ClassA { int x=20: static int y=6; public static void main(String args[]) { ClassB b=new ClassB; 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 exl9 { public static void main(string[] args) { int x=3; int y=7; switch(y/x){ case 1: y*=2; break; case 2: y*=3; break; case 3: y*=4; break; default: y=0; } System.out.print(y); } }A.28B.21C.14D.0

下面程序段的输出结果为 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.编译不通过

下面的例子中using System;class A{public static int X;static A(){X=B.Y+1;}}class B{public static int Y=A.X+1;static B(){}static void Main(){Console.WriteLine("X={0},Y={1}",A.X,B.Y);}}产生的输出结果是什么?

下列程序的运行结果是( )。 Public class sun { Public static void main(String args[]) { int x=4,y=0; if(Math.pow(X,2)= =16) y—x ; if(Math.pow(X,2)15) y—l/x; if(Math.pow(X,2)15) y=(int)Math.pow(X,2)+1; system.out.println(y); } }A.4B.17C.18D.0.25

执行如下语句之后,输出的结果是______。 public class ex24 { public static void main(String[] args) { int x=5,y=3; x+=X-- *--y; System.out.println{x); } }A.0B.1C.trueD.false

执行下列代码之后,输出的结果为______。 public class ex27 { public static void main(String[] args) { iht x=7; int y=15; boolean bb=(127|x)>7(-128∧y)<15; System.out. println(bb); } }A.trueB.0C.1D.false

执行下列程序段之后,输出的结果为______。 public class ex41 { public static void main(string[] args) { int x=15; byte y=1; x>>=y++; System.out.println(x); } }A.3B.7C.14D.10

下列代码执行之后,输出的结果为______。 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 ex1{ public static void main(String[]args){ int x=5,y=3, x+=x--*--y System.out.println(x); }}A.12B.8C.15D.16

执行如下语句之后,输出的结果是______。 public class ex36 { public static void main(String[] args) { int x=-6, y=6; x=x+y--; System.out.println (x); } }A.-12B.12C.-1D.0

以下程序的输出结果为: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

class DemoApp{  public static void main(String[] args){  int x = 5; int y = ++x + x++; S ystem.out.println(“y=”+y+”,x=”+x);  }  }  以上程序运行后的输出结果是哪项?() A、y=10,x=5B、y=11,x=6C、y=12,x=7D、y=11,x=7

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

单选题public class WhileFoo {  public static void main (String []args)   {  int x= 1, y = 6;  while (y--)  {x--;}  system.out.printIn(“x=” + x “y =” + y);  }  }   What is the result?()A The output is x = 6 y = 0B The output is x = 7 y = 0C The output is x = 6 y = -1D The output is x = 7 y = -1E Compilation will fail.

单选题现有:  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