题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-12-02 06:27:43

[单项选择] 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?()
A. 5
B. 10
C. 12
D. 17
E. 24

更多"1.public class Test{ 2.int x=12; 3."的相关试题:

[单项选择]阅读下列代码: public class Test{ public static void main(String args[]{ System.out.println(100%3); System.out.pnntln(100%3.0); } } 程序运行结果为( )。
A. 1和1
B. 1和1.0
C. 1.0各1
D. 1.0和1.0
[单项选择] public class Test{ public static void main(String[]args){ intx=5; boolean b1=true; boolean b2=false; if((x==4)&&!b2) System.out.print("l"); System.out.print("2"); if((b2=true)&&b1) System.out.print("3"); } } What is the result?()
A. 2
B. 3
C. 12
D. 23
E. 123
F. Compilation fails.
G. An exceptional ist hrown at runtime.
[单项选择]现有:class Test2 fpublic static void main (String [] args) {short a,b,C;a=1;b=2;C=a+b;a+=2;}}以上代码中,哪一句是错误的?()
A. a=1;
B. C=a+b;
C. a+=2;
D. shorta,b,C;
[单项选择]阅读下面程序 public class Test2 {  public static void main(String[] args) {   int a=10,b=4.c=20,d=6;    System.out.println(a++*b+c*--d);  } } 程序运行的结果是
A. 144
B. 160
C. 140
D. 164
[单项选择]阅读下面程序 public class Test4 {  public static void main(String[] args) {   int 1=10,j=3;   float m=213.5f,n=4.0f;   System.out.println(i%j);   System.out.println(m%n);  } } 程序运行的结果是
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5
[单项选择]阅读下面程序 public class Test3 {  public static void main(String[] args) {   int x=3,y=4,z=5;   String s="xyz":   System.out.println(s+x+y+z);  } } 程序运行的结果是
A. xyz12
B. xyz345
C. xyzxyz
D. 12xyz
[单项选择]

阅读下列代码
public class Test{
public static void main(String args[]){
System. out. println((2<0) 10:8);
}
}
其运行结果是()


A. 2
B. 0
C. 10
D. 8
[单项选择]阅读下面程序 public class Test1 { public static void main(String[] args) {  System.out.println(34+56-6);  System.out.println(26*2-3);  System.out.println(3*4/2);  System.out.println(5/2);  } } 程序运行的结果是
A. 84 49 6 2
B. 90 25 6 2.5
C. 84 23 12 2
D. 68 49 14 2.5
[单项选择]下列语句输出结果为( )。public class test{public static void main(String args []){String s1=new String("How");String s2=new String("How");System.out. println(!(s1 ==s2));}
A. false
B. true
C. 1
D. 0
[单项选择] 下列代码的输出是()。 public class test{public static void main(String args[]) {System.out.print("IBM/n012/63ABC//".length( ));}}
A. 12
B. 13
C. 14
D. 15
[单项选择]下列程序的功能为( )。public class Test2{public static void main(Stringargs[]){int i,s=0;for(i=1;i<10;i+=2)s+=i+1;System.out. pnntln(s);}}
A. 计算自然数1~9的累加和
B. 计算自然数1~10的累加和
C. 计算自然数1~9中的奇数之和
D. 计算自然数1~10中的偶数之和
[单项选择]有如下类定义: class Test { private int x; public int y; public void setX (int m) {x=m;} public int getX( ) {return x;} }现用Test t=new Text( );生成一个对象t,则如下语句中,错误的是( )。
A. x=10;
B. y=10;
C. setX(10);
D. int m=getX( );
[多项选择] 包pack1的类class1中有成员方法: protected void method_1(){„}, private void method_2() {„},  public void method_3() {„}  和  void method_4() {„},  在包pack2中的类class2是class1的子类,你在class2中可以调用方法()。 
A. method_1
B. method_2
C. method_3
D. method_4
[单项选择]阅读下列代码 public class Test{ public static void main(String args[]){ System.out.println(89>>1); } } 其运行结果是【 】
A. 44
B. 45
C. 88
D. 90
[单项选择]阅读下面代码 class Test implements Runnable {  public int run( ) {   int i=0;   while(true) {    i++;    System.out.println("i="+i);   }  } } 上述代码的编译结果是
A. 程序通过编译,并且run()方法可以正常输出递增的i值
B. 程序通过编译,调用run()方法将不显示任何输出
C. 程序不能通过编译,因为while的循环控制条件不能为true
D. 程序不能通过编译,因为run()方法的返回值类型不是void
[单项选择]阅读下面程序 class Test implements Runnable {  public static void main(String[] args) {   Test t=new Test( );   t.start( ):  }  public void run( ) {} } 下列关于上述程序的叙述正确的是
A. 程序不能通过编译,因为start()方法在Test类中没有定义
B. 程序编译通过,但运行时出错,提示start()方法没有定义
C. 程序不能通过编译,因为run()方法没有定义方法体
D. 程序编译通过,且运行正常
[单项选择] 类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()
A. public float aMethod(float a, float b,float c){ return 0;}
B. public float aMethod(float c,float d){ return 0;}
C. public int aMethod(int a, int b){ return 0;}
D. private float aMethod(int a,int b,int c){ return 0;}
[单项选择]阅读下列代码 public class Test 2005{ public static void main(String args[]){ System.out.println((3>2)4:5); } } 其运行结果是【 】
A. 2
B. 3
C. 4
D. 5

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码