1. public class X { 2. public static void main (String[]args) { 3. int [] a = new int [1] 4. modify(a); 5. System.out.printIn(a[0]); 6. } 7. 8. public static void modify (int[] a) { 9. a[0] ++; 10. } 11. } What is the result?()
相似题目
-
1. public class Test { 2. int x= 12; 3. public void method(int x) { 4. x+=x; 5. System.out.println(x); 6. } 7. } Given: 34. Test t = new Test(); 35. t.method(5); What is the output from line 5 of the Test class?()
-
class Rectangle { public static void main(String [] args) { int [] x = {1,2,3}; x[1] = (x[1] 〉 1) ? x[2] : 0; System.out.println(x[1]); } } 结果为:()
-
class TestApp{ public static void main(String[] args){ System.out.println(multiply(2,3,4,5)); } public int multiply(int... nums){ int result=1; for(int x:nums) result*=x; return result; } } 程序运行后的输出是哪项?()
-
现有: 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 结果为:()
-
class TestReference{ public static void main(String[] args){ int x=2; TestReference tr = new TestReference(); System.out.print(x); tr.change(x); System.out.print(x); } public void change(int num){ num = num + 1; } } 程序运行后的输出是哪项()?
-
程序: class TestApp{ public static void main(String[] args){ System.out.println(multiply(2,3,4,5)); } public int multiply(int[] nums){ int result = 1; for(int x :nums) result *= x; return result; } } 程序运行后的输出是哪项?()
-
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 结果为:()
-
1. public class returnIt ( 2. returnType methodA(byte x, double y) ( 3. return (short) x/y * 2; 4. ) 5. ) What is the valid returnType for methodA in line 2?()
-
1. public class ReturnIt { 2. return Type methodA(byte x, double y) { 3. return (long)x / y * 2; 4. } 5. } What is the narrowest valid returnType for methodA in line2?()
-
1.public class Test{ 2.int x=12; 3.public void method(intx){ 4.x+=x; 5.System.out.println(x); 6.} 7.} Given: 34.Test t=new Test(); 35.t.method(5); What is the output from line 5 of the Test class?()
-
1. public class Blip { 2. protected int blipvert(int x) { return 0; } 3. } 4. class Vert extends Blip { 5. // insert code here 6. } Which five methods, inserted independently at line 5, will compile?()
-
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 结果为:()
-
1. public class Boxer1 { 2. Integer i; 3. int x; 4. public Boxer1(int y) { 5. x=i+y; 6. System.out.println(x); 7. } 8. public static void main(String[] args) { 9. new Boxer1(new Integer(4)); 10. } 11. } What is the result?()
-
Given: 1. public class ConstOver { 2. public constOver(int x, int y, int z) { 3. } 4. } Which two overload the ConstOver Constructor?()
-
现有2 个文件: 1. package x; 2. public class X { 3. public static void doX() { System.out.print("doX "); } 4. } 和: 1. class Find { 2. public static void main(String [] args) { 3. //insert code here 4. } 5. } 哪两行分别插入到类Find 的第3 行将编译并产生输出“doX”? ()
-
1. public class A { 2. public void doit() { 3. } 4. public String doit() { 5. return “a”; 6. } 7. public double doit(int x) { 8. return 1.0; 9. } 10.} What is the result?()
-
1. public class ReturnIt { 2. return Type methodA(byte x, double y) { 3. return (short)x / y * 2; 4. } 5. } What is the narrowest valid returnType for methodA in line2?()
-
以下程序的运行结果为:1. public class Conditional {2. public static void main(String args [] ) {3. int x = 4;4. System.out.println( \value is \ +5. ((x > 4) ? 99.99 : 9));6. }7. }
-
class Demo{ public static void main(String[] args){ int x = 0; try{ x = div(1,2); }catch(Exception e){ System.out.println(e); } System.out.println(x) ; } public static int div(int a,int b){ return a / b ; } }
-
运行下面程序时,会产生什么异常?( )public class X7_1_4 {public static void main(String[] args) {int x = 0;int y = 5/x;int[] z = {1,2,3,4};int p = z[4];}}ArithmeticException |NumberFormatException|ArrayIndexOutOfBoundsException |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 = p/x; } }
-
请依次说出【代码1】-【代码2】的输出结果。注意:结果之间用英文的分号分隔 interface A{ double f(double x, double y); } class B implements A{ public double f(double x, double y){ return x*y; } int g(int a, int b){ return a+b; } } public class E{ public static void main(String args[]){ A a=new B(); System.out.println(a.f(3,5)); // 【代码1】 B b=(B)a; System.out.println(b.g(3,5)); // 【代码2】 } }
-
9、类的定义如下,其中错误的语句行是()。 class B{ int x; protected: int y; public: int z; }; class D: public B{ int m; void f(){ x=0; //L1 y=1; //L2 z=2; //L3 m=3; //L4 } };
-
执行下列程序段后输出的结果是______。 public class Test 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-=2;System.out.println(y);
推荐题目
- 下列何种不属于催化果胶解聚的酶()。
- win系统和unix系统对应V2安装包一样。
- 花钵
- 两个以上的企业因已登记注册的企业名称相同或者近似而发生争议的,登记主管机关依照()在先原则处理。
- 车辆进行台试检验制动力时,在制动力(),左右轮制动力差与该轴左右轮中制动力大者之比对前轴不应大于20%。
- TTL与非门的输入端可以接任意阻值电阻,而不影响器输出电平。
- 下列选项中,属于汇票出票的绝对必要记载事项的有()。
- 接近的侵入飞机显示为白色的实心棱形。()
- 2、中医认为,气是构成人体的最基本物质,也是维持人体生命活动的最基本物质。
- 《关于深化和完善城镇居民小区治理的意见》到()年,实现居民小区党的组织和工作全覆盖、居民自治组织全覆盖、物业服务管理全覆盖