题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-10 21:50:03

[单项选择]

下列代码的编译或执行结果是()。
public class MyVal
public static void main(String[] args)
MyVal m=new MyVal( );
m.aMethod( );

public void aMethod( )
boolean [] b=new Boolean [5];
System.out.println(b[0]);


A. 1
B. null
C. 0
D. 编译错误

更多"下列代码的编译或执行结果是()。 public class MyVal"的相关试题:

[单项选择]下列代码的编译或执行结果是 public class MyVal { public static void main(String[] args) { MyVal m = new MyVal( ); m.aMethod( ); } public void aMethod( ){ boolean [] b = new Boolean [5]; System.out.println(b[0]); } }
A. 1
B. null
C. 0
D. 编译错误
[单项选择]下列代码的编译或执行结果是( )。
public class Myval
public static void main(string args[])
MyVal m=new MyVal( );
m.aMethod( );

public void aMethod( )
boolean b[]=new Boolean[5];
System.out.println(b[0]);

A. 1
B. null
C. 0
D. 编译错误
[单项选择]下列代码的编译或执行结果是______。
public class MyVal
puhlic static void main(String args[])
MyVal m=new MyVal( );
m.aMethod( );

public void aMethod( )
boolean b[]=new Boolean[5];
System.out.println(b[0]);

A. 1
B. null
C. 0
D. 编译错误
[单项选择]下列代码的执行结果是( )。
public class Test
public static void main(String args[])
System.out.println(7/2);

A. 3.5
B. 3
C. 3.0
D. 3.50
[单项选择]

下列代码的执行结果是()。
public class Test
public static void main(String[] args)
int[] x=0,1,2,3;
for(int i=0;i<3;i+=2)
try
System.out.println(x[i+2]/x[i]+x[i+1]);
catch(ArithmeticException e)
System.out.println("error1");
catch(Exception e)
System.out.println("error2");


A. error1
B. error2
C. error1
D. 2
[单项选择]下列代码的执行结果是()public class Test { public static void main(String[] args) { int[] x={0,1,2,3}; for(int i=0;i<3;i+=2){ try{ System.out.println(x[i+2]/x[i]+x[i+1]); }catch(ArithmeticException e){ System.out.println("error1"); }catch(Exception e){ System.out.println("error2"); } } } }
A. error1
B. error2
C. error1     error2
D. 2     error2
[单项选择]下列代码的执行结果是 ( )
public class Test2public static void main(String args[])int a=4,b=6,c=8;
String s="abc";
System.out.println(a+b+s+c);
A. "ababcc"
B. "464688"
C. "46abc8"
D. "10abc8/
[单项选择]下列代码的执行结果是:( ) public class Test1 public static void mian(String args[]) float t=9.0f int q=5; System.out.println((t++)*(--q));
A. 40
B. 40.0
C. 36
D. 36.0
[单项选择]下列代码的执行结果是( )。 public class test5 public static void main (String args[]) String s1=new String("hello"); String s2=new String("hello"); System.out.prim(s1==s2); System.out.print(","); System.out.println(s1.equals(s2));
A. true,false
B. true,true
C. false,true
D. false,false
[单项选择]下列代码编译或执行结果的描述中,正确的是 class Test{ public static void main(String args[]){ TestThread pm1 = new TestThread("One"); pm1.start( ); TestThread pm2 = new TestThread("Two"); pm2.start( ); } } class TestThread extends Thread{ private String sTname=""; TestThread(String s){ sTname = s; } public void run( ){ for(int i=0;i<2;i++){ try { sleep(1000); } catch (InterruptedException e) {} System.out.println(sTname+" "); } } }
A. 不能通过编译,TestThread类中不能定义变量和构造方法
B. 输出 One One Two Two
C. 输出 Two One One Two
D. 选项B或C都有可能出现
[单项选择]

下列代码编译或执行结果的描述中,正确的是()。
class Test
public static void main(String args[])
TestThread pm1=new TestThread("One");
pm1.start( );
TestThread pm2=new TestThread("Two");
pm2.start( );


class TestThread extends Thread
private String sTname="";
TestThread(String s)
sTname=s;

public void run( )
for(int i=0;i<2;i++)
try
sleep(1000);
catch (InterruptedException e)
System.out.println(sTname+" ");


A. 不能通过编译,TestThread类中不能定义变量和构造方法
B. 输出 One One Two Two
C. 输出 Two One One Two
D. 选项B或C都有可能出现
[单项选择]下列程序的执行结果是  public class Testhh    public static void main(String args [] )     Strings1=new String("I am boy");    Strings2=new String("I am boy");     System.out.println(s1.equals(s2));     
A) true
B) falseC) I am boy D) 都不正确

[单项选择]阅读下面代码
public class Arrays
 public static void main(String[] args)
  int[] a=new int[5];
  for(int i=0;i<a.length;i=i+1)a[i]=10+i;
  for(int i=0;i<a.length;i=i+1)System.out.println(a[i]);
  String[] s="Frank","Bob","Jim";
  for(int i=0;i<s.length;i=i+1)System.out.println(s[i]);
  s[2]="Mike";
  System.out.println(s[2]);
 

代码运行正确的结果是
A. 10
B. 11
C. 10
D. 11
[单项选择]阅读下列代码
public class Arrays
public static void main(String[]args)
int[]a=new int[5];
for(int i=0;i<a. length; i=i+1)
a[i]=10+i;

for(int i=0; i<a. length; i=i+1)
System. out. println(a[i]);

String[]s="Frank","Bob","Jim";
for(int i=0; i<s. length; i=i+1)
System. out. println(s[i]);

S[2]="Mike";
System. out. println(s[2]);


代码运行结果正确的是
A. 10
B. 11
C. 10
D. 11
[单项选择]下面程序的输出结果是
public class Test
 public static void main(String[] args)
  int[]array=2,4,6,8,10;
  int size=6;
  int result=-1:
  try
   for(int i=0;i<size&&result==-1;i++)
    if(array[i]==20)result=i;
catch(ArithmeticException e)
   System.out.println("Catch---1");
  catch(ArrayIndexOutOfBoundsException e)
   System.out.println("Catch---2");
  catch(Exception e)
   System.out.println("Catch---3");
  
 

A. Catch---1 B) Catch一--2 C) Catch---3 D) 以下都不对

我来回答:

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

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码