给出下列程序,正确的输出是?class A {public static void main(String[] a) {int x = 5, y = 6;x += y--;y &= x;System.out.println("x="+ x + "\ty="+ y);}}
答:A. x=11 y=1
继续答题:下一题


更多JAVA程序设计试题
- 1下列关于构造方法重载的说法中,错误的是( )
- 2请阅读下面的程序,选择正确的运行结果。class Demo{private static int x ;public static void main(String[] args){System.out.println(x++);}}
- 3关于final修饰成员变量说法正确的是?
- 4下列程序运行结果是( )interface InterfaceA{String s="good ";void f();}abstract class ClassA{abstract void g();}class ClassB extends ClassA implements InterfaceA{void g(){System.out.print(s);}public void f(){System.out.print(" "+s);}}public class E {public static void main(String[] args) {ClassA a=new ClassB();InterfaceA b=new ClassB();a.g();b.f();}}
- 5阅读下面的代码片段public static int add(int a,int b) {return a + b;}下列选项中,可以在main()方法中调用add()方法的是
- 6编译运行下面的程序,结果是什么?public class A {public static void main(String[] args) {B b = new B();b.test();}void test() {System.out.print("A");}}class B extends A {void test() {super.test();System.out.print("B"); }}