单选题public class Test { public static void leftshift(int i, int j) { i=j; } public static void main(String args[]) { int i = 4, j = 2; leftshift(i, j); System.out.printIn(i); } } What is the result?()A 2B 4C 8D 16E The code will not compile.
单选题
public class Test { public static void leftshift(int i, int j) { i<<=j; } public static void main(String args[]) { int i = 4, j = 2; leftshift(i, j); System.out.printIn(i); } } What is the result?()
A
2
B
4
C
8
D
16
E
The code will not compile.
参考解析
解析:
暂无解析
相关考题:
下列程序段的输出结果是【 】。public class Test {void printValue(int m) {do {System.out.println("The value is"+m);}while (--m>10);}public static void main (String args[]) {int i=10;Test t= new Test();t.printValue(i);}}
能将程序补充完整的选项是( )。class Person{ private int a; public int change(int m){ return m; }}public class Teacher extends Person{ public int b; public static void main(String arg[]) { Person p = new Person(); Teacher t = new Teacher(); int i; ______ }} B.A.i=mB.i=bC. i=p.aD.i=p. change(50)
下面代码段的输出结果为( )。 public class Test { public static void main(String sss[]) { int i=0xFFFFFFFl; int j=~i; } }A.0B.1C.14D.-15
下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }A.String:String first,int:11B.int:11,String:Int firstC.String:String first,int99D.int:99,String:Int first
下面程序的输出结果是什么? class C1{ static int j=0; public void method(int a){ j++; } } class Test extends C1{ public int method(){ return j++; } public void result(){ method(j); System.out.println(j+method()); } public static void main(String args[]){ new TeA.0B.1C.2D.3
下列程序的执行结果是 ( ) public class Test { public int aMethod() { satic int i=0; i++; System.out.println(i); } public static void.main(String args[]) { Test test=new Test(); test.aMethod(); }A.编译错误B.0C.1D.运行成功,但不输出
下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出
下列程序的输出结果是public class fff { void printValue (int m) { do { System.out.println("The value is" +m); } while(--m>10) } public static void main (String arg[]) { int i=10; Test t= new Test(); t. printValue(i); }}A.8B.9C.10D.11
下面程序段的输出结果是 class Base { int i; Base() { add(1); } void add(int v) { i+=v; } void print() { System.out.println(i); } } class Extension extends Base { Extension() { add(2); } void add(int v) { i+=v*2; } } public class Test { public static void main(String args[]) { bogo(new Extension()); } static void bogo(Baseb){ b.add(8); b.print(); } }A.9B.18C.20D.22
下列程序输出结果为( )。public class test { public static void main(String args[]) { int a=0; outer: for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { if(j>i) { continue outer; } a++; } } System.out.println(a); }}A.0B.2C.3D.4
下列程序执行后,j的值是( )。 public class Test { public static void main(String args[]) { int j=1; for(int i=7;i>0;i-=2) j*=2; System.out.println(j); } }A.15B.1C.32D.16
下列程序输出结果为( )。 public class test { public static void main (String args[]) { int a=0; outer:for(int i=0;i<2;i + +) { for(int j=0;j<2;j+ +) { if(j>i) { continue outer; } a+ +; } } System.out.println(a); } }A.0B.2C.3D.4
下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.
3下列程序段运行的结果为( )。 public class Test{ static void print(String s,int i){ System.out.pdntlnC String: "+s+",int:"+i); } static void print(iht i,String s){ System.out.prinflnCint:"+i+",gtring:"+s); } public static void main(String[] args){ print(99,"Int first"); } }A.String:String first,int: 11B.int: 11,String:Int firstC.String:String first,int:99D. int:99,Stfing:Int first
以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public static void main(String args []) {new Demo().some(7);}}class Demo extends Test {int m=8;public void some(int x) {super.some(x);System.out.println(m);}}A.5B.8C.7D.无任何输出E.编译错误
1) class Person { 2) public void printValue(int i, int j) {/*…*/ } 3) public void printValue(int i){/*...*/ } 4) } 5) public class Teacher extends Person { 6) public void printValue() {/*...*/ } 7) public void printValue(int i) {/*...*/} 8) public static void main(String args[]){ 9) Person t = new Teacher(); 10) t.printValue(10); 11) } 12) } Which method will the statement on line 10 call?() A、 on line 2B、 on line 3C、 on line 6D、 on line 7
public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i) { boolean b: b = i 10 | methodB (4); b = i 10 || methodB (8); ) public static void main (String args) } ( methodA (0); system.out.printIn(j); ) ) What is the result?() A、 The program prints “0”B、 The program prints “4”C、 The program prints “8”D、 The program prints “12”E、 The code does not complete.
现有: public class TestDemo{ private int X-2; static int y=3; public void method(){ final int i=100; int j =10; class Cinner { public void mymethod(){ //Here } } } } 在Here处可以访问的变量是哪些?() A、XB、yC、jD、i
public class Test { public static void leftshift(int i, int j) { i=j; } public static void main(String args[]) { int i = 4, j = 2; leftshift(i, j); System.out.printIn(i); } } What is the result?() A、 2B、 4C、 8D、 16E、 The code will not compile.
public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main (String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } } What is the result?() A、 0B、 1C、 2D、 Compilation fails.
Given the following code: public class Test { void printValue(int m){ do { System.out.println("The value is"+m); } while( --m 10 ) } public static void main(String arg[]) { int i=10; Test t= new Test(); t.printValue(i); } } Which will be output?() A、 The value is 8B、 The value is 9C、 The value is 10D、 The value is 11
单选题public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main (String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } } What is the result?()A 0B 1C 2D Compilation fails.
单选题public class test( public int aMethod()[ static int i=0; i++; return I; ) public static void main (String args){ test test = new test(); test.aMethod(); int j = test.aMethod(); System.out.printIn(j); ] } What is the result?()A Compilation will fail.B Compilation will succeed and the program will print “0”C Compilation will succeed and the program will print “1”D Compilation will succeed and the program will print “2”
多选题现有: public class TestDemo{ private int X-2; static int y=3; public void method(){ final int i=100; int j =10; class Cinner { public void mymethod(){ //Here } } } } 在Here处可以访问的变量是哪些?()AXByCjDi
单选题public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i 10 | methodB (4); b = i 10 || methodB (8); ) public static void main (String args[])( methodA (0); system.out.printIn(j); ) ) What is the result?()A The program prints “0”B The program prints “4”C The program prints “8”D The program prints “12”E The code does not complete.
单选题1) class Person { 2) public void printValue(int i, int j) {/*…*/ } 3) public void printValue(int i){/*...*/ } 4) } 5) public class Teacher extends Person { 6) public void printValue() {/*...*/ } 7) public void printValue(int i) {/*...*/} 8) public static void main(String args[]){ 9) Person t = new Teacher(); 10) t.printValue(10); 11) } 12) } Which method will the statement on line 10 call? ()A on line 2B on line 3C on line 6D on line 7
单选题public class Test { public static void leftshift(int i, int j) { i=j; } public static void main(String args[]) { int i = 4, j = 2; leftshift(i, j); System.out.printIn(i); } } What is the result?()A 2B 4C 8D 16E The code will not compile.
多选题public class TestDemo{ private int x = 2; static int y = 3; public void method(){ final int i=100; int j = 10; class Cinner{ public void mymethod(){ //Here } } } } 在Here处可以访问的变量是哪些?()AxByCiDj