a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 96|回复: 1

[考试试题] 2011年JAVA认证模拟题(8)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
 Q22 Which of the following are t rue about the following program?   class Question {
# r, k& i+ U9 w/ N& L  public static void main (String args[])' s0 D' ~& S2 J7 |7 I  l
  {
, c0 b/ g4 s  q2 }0 e7 ^9 `% D  MyThread t1 = new MyThread(“t1”);
& X) P! H4 s8 g9 \) r' h; h, N  MyThread t2 = new MyThread(“t2”);. k/ Q" E, F( d1 J' i5 m
  t1.start();
+ f" t3 a. k- _( g# V  t2.start();6 r: w9 g2 D$ D/ W- o- N
  }6 [* J8 M. s+ U  |' s$ F/ I8 }/ y8 E
  }8 z. ^1 S' I' i6 Y
  class MyThread extends Thread {  R/ R4 V7 z5 Z: w0 v
  public void displayOutput (String s) {
3 D% q8 _* G6 F, J) q$ a  System.out.println(s);; X  c! R: S0 B3 Q8 P( B+ b
  }
" C6 `) q" Z& N- h- A# i% w- f$ m; i  public void run() {. W( H$ D0 y& ~, \# |) R

) g; a) a2 h* s: ^. V4 G  for (int i=0; i
回复

使用道具 举报

 楼主| 发表于 2012-8-4 12:33:17 | 显示全部楼层

2011年JAVA认证模拟题(8)

  public class TestIOApp {
% C0 x0 f: v* D; i  k6 _% b  public static void main(String args[])
5 M5 c  X5 Z, P  throw IOException {7 U/ s" C# `% q1 W
  RandomAccessFile file = new4 t  f. I; N1 N9 ?
  RandomAccessFile(“test.txt”, “rw”);
' K4 E: d8 |: T( q  file.writeBoolean(true);- ?/ y& a1 O% J' E$ j
  file.writeInt(123456);% ?+ w# D2 ^& @! r! \
  file.writeInt(7890);6 A% g' t: t% b& O; C& n+ R
  file.writeLong(10000000);7 y1 |% [8 ?) ~
  file.writeInt(777);% k! T$ `  L" C7 X$ z
  file.writeFloat(.0001f);
/ w5 B8 c& L( i. V( y  file.seek(5);
' T( M& f5 A! I: y( a( N  System.out.println(file.readInt());
+ Y3 a4 t& j& u( g5 L9 m  file.close();
) ^# ?7 Q5 E, Y  d  }/ K: k: p: p) z+ D3 d0 L8 }- F
  }
+ d& h- V& ~- ^) N4 a  A 1234561 e) V1 a; X( |2 M
  B 7890
& d; I. D8 y& `' d; V% f  F  C 10000000
; e6 e" S/ w& y  D 777
! l8 j3 R( A& b" P  Q24 Given a component, comp, and a container, cont, that is organized according to a BorderLayout, which of the following should be used to add comp to the top of the container.- C$ U& Q# a. h* U1 V
  A addTop(cont, comp);
2 R$ r1 H4 _% c% Q  B comp.add(“North”, cont);
* d8 [8 q( n& _  C cont.add(“North”, comp);
! `# ?/ t/ V6 v) `2 _: u  D cont.addTop(comp);
4 [* y( b% B. Y; }) M  Q022 D
1 n7 ^' r2 j$ u5 Y  Q023 B9 p; j  V0 M/ Q% Z0 V
  Q024 C
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-19 07:03 , Processed in 0.306435 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表