题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-04-22 21:47:31

[单项选择]下面的程序执行后,屏幕上显示的应是( )。
public class Exam
public static void main(String[]args)
char char1[]='t','e','s','t';
char char2[]='t','e','s','t','l';
String s1=newString(charl);
String s2=newString(char2,0,4);
System.out.println(s1.equals(s2));


A. true
B. false
C. test
D. 编译错误

更多"下面的程序执行后,屏幕上显示的应是( )。 public clas"的相关试题:

[单项选择]下面的程序执行后,屏幕上显示的应是( )。
Pubhc class Exam
public static void main(String[] args)
charchar1[]='t','e','s','t';
charchat2[]='t','e','s','t','1'
Sbing s1=new String(char1);
String s2=new String(char2,0,4);
System.out.println(s1.equals(s2));


A. true
B. false
C. test
D. 编译错误
[单项选择]下面的程序执行后,屏幕上应显示______。
public class Test
public static void main(String[] args)
char char1[]='t','e','s','t';
char char2[]='t','e','s','t','1';
String s1=new String(char1);
String s2=new String(char2,0 ,4);
System.out.println(s1.equals(s2));


A. true
B. false
C. test
D. 编译错误
[单项选择]下列程序执行后,屏幕上显示的应是( )。   public class Testyyy   {public static void main(String[]args)    { char charl[]={,’’t’’ ’’e’’’’s],’’t’’};     char char2[]={’’t’’,’’e’’,’’s’’,’’t’’,’’1’’};     String s1=new String(char1);     String s2=new String(char2,0,4);     System.out.println(s1.equals(s2));    }   }
A. true
B. false
C. test
D. 编译错误
[单项选择]请阅读下面程序
public class ExampleStringBuffer
public static void main(String []args)
StringBuffer sb=new StringBuffer("test");
System.out.println("buffer="+sb);
System.out.println("length="+sb.length( ));
程序运行结果中在"length="后输出的值是( )。
A. 10
B. 4
C. 20
D. 30
[单项选择]下面程序执行后,baz的值应是______。
public class Test9

public static void main(String[] args)

int index = 1;
int fox[] = new int [3];
iht bar = fox [index];
int baz = bar + index;
System.out.println(baz);


A. 0 B. 1 C. 2 D. 编译错误
[单项选择]下列程序执行后,k的值是
    public class Testhhh
     public static void main(String args[ ])
     
      inti=6,j=8,k=10,m=7;
      if(i>j| |m       k++;
      else k- -;
      System.out.println(k);
      
    
A)12
B)11
C)10
D)9

[单项选择]阅读下面程序
public class Increment
public static void main(stringargs[])
int c;
c=5:
System.out.println(c);
System.out.println(c++);
System.out.println(c);


程序运行结果是( )。
A. 5
B. 5
C. 6
D. 6
[单项选择]下列程序执行后,k的值是 ( )
public class Testhhh

publicstaticvoidmain(Stnngargs[])

int i=6,j=8,k=10,m=7;
if(i>j||m<k- -)
k+ +;
else k--;
System.out.println(k);
A. 12
B. 11
C. 10
D. 9
[单项选择]阅读下面程序 public class Increment { public static void main( String args[] ){ int c; c=5; System.out.println(C) ; System.out.println(c++); System.out.println(C) ; } } 输出结果是【 】
A. 5 6 6
B. 5 5 6
C. 6 7 7
D. 6 6 6
[单项选择]

请阅读下面程序
public class ExampleStringBuffer{
public static void main(String []args){
StringBuffer sb=new StringBuffer("test");
System.out.println("buffer="+sB) ;
System.out.println("length="+sb.length( ));
}
}
程序运行结果中在"length="后输出的值()


A. 10
B. 4
C. 20
D. 30
[单项选择]

请阅读下面程序
public class ForLoopStatement {
public static void main(string []args){
int i,j;
for (i=1; i<5; i++) { //i循环
for (j=1;j<=i;j++) //j循环
System.out.print(i+"×"+j+"="+i*j+" ");
System.out.println( );
}
}
}
程序完成后,i循环和j循环执行的次数分别是()


A. 4,10
B. 8,9
C. 9,8
D. 10,10
[单项选择]阅读下面程序
public class Test3
public static void main(String args[])
int x=3, y=4, z=5;
String s="xyz";
System.out.primln(s+x+y+z);


程序运行的结果是
A. xyzl2
B. xyz345
C. xyzxyz
D. 12xyz
[单项选择]有下面程序段:
Public class ArrayTest

Public static void main(String args[])

int[] intArray=new int[3];
for(int I=0;I<3;I++)

intArray[I]=I+2;
System.out.println("IntArray["+I+"]"-"+intArray[I]);

System.out.println("------------");
Int arrLen=4;
IntArray=new int[arrLen];
For(int j=intArray.length;j>=0;j--

intArray [j]=j*3;
System. out.println("hello"+intArray[j]);


则运行的结果是( )。
A. 编译出错
B. 编译通过,但运行出错
C. 可以运行,但有错误
D. 以上都不对
[单项选择]

请阅读下面程序
public class ThreadTest {
public static void main(String args[]) throws Exception{
int i=0;
Hello t=new Hello( );
____;
while(true) {
System.out.println("Good Moming"+i++);
if (i==2 && t.isAlive( )) {
System. out.println("Main waiting for Hello!");
t.join( ); //等待t运行结束
}
if(i==5) break;
}
}
}
class Hello extends Thread {
int i;
public void run( ) {
while(true){
System.out.println("Hello"+i++);
if (i==5) break;
}
}
}
为使该程序正确执行,下划线处的语句应是()


A. sleep()
B. yield()
C. interrupt()
D. start()
[单项选择]

请阅读下面程序
public class ThreadTest{
public static void main(String args[]) {
Thread t1=new Thread(new Hello( ));
Thread t2=new Thread(new Hello( ));
t1.start( );
t2.start( );
}
}
class Hello implements Runnable {
int i;
public void run( ) {
while(true) {
System.out.prinfin("Hello"+i++);
if(i=5) break;
}
}
}
该程序创建线程使用的方法是()


A. 继承Thread类
B. 实现Runnable接口
C. t1.start()
D. t2.start()

我来回答:

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

订单号:

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