a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 48|回复: 0

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

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
  Q139 What is the output displayed by the following program?
; w6 v* H: W) i9 |  class Question {
7 K1 V5 g9 f$ E. H; v  public static void main (String[] args)9 M# u5 X9 ]9 X( K. p
  {( K8 J: M8 [. U; m
  String s1 = “ab”;
1 _; ^, z/ h. _" `  String s2 = “abcd”;
% ~" U% D2 G4 b( u0 j, a  String s3 = “cd”
: k0 g2 [4 P" t+ S2 G5 U  String s4 = s1 + s3;/ K/ O4 {5 W" {2 ?; w3 i
  s1 = s4;( Q- c3 X" ?3 X2 v
  System.out.print(“s1 “ + (( s1== s2) ?- M3 b& ^4 p# f
  “==” : “!=”) + “ s2”);
" I) J! i2 s9 y/ Y9 E/ _0 B  }" q% C% {1 w8 K; a2 e- i+ d
  }
" V: N% h& J3 m: {, s) R  A s1 == s2
( M# @" U; o) [8 E/ _; Y8 I  J7 t  B s1 != s2
2 E- i2 ?( |% z9 `, v4 R' z/ g  C s1
1 h( |! ~  `8 e& }$ A& O  D s1 == “abcd”! F: l3 Z, i, g) u( W$ T5 m
  Q140 Which of the following are true about constructors?
, e1 M( a4 S. B4 r/ ^. p- P; P: ^  A A class inherits its constructors from its parent.' n/ M. e5 _7 Z
  B The compiler supplies a default constructor if no constructors are
' C9 R( u+ C; h9 h9 W  provided for a class.
1 u/ o5 A# s5 v2 U2 n, o  C All constructors have a void return type.
# i# a* a2 z# `5 v/ q  D A constructor may throw an exception.
. N: E" O. `6 m  Q141 Which of the following are primitive types?
. G7 V& H2 r& n. c6 E) s$ Z  A byte
: j# i7 C* l' u" ?  B String4 R9 r# u% M8 u( x
  C integer8 O) }$ P- s' i. W1 }
  D Float5 U& Y* X; {5 u+ t  u
  Q139 B
1 [& y& C9 N+ S( d  Q140 BD
7 |+ x3 h# i; R9 L6 s' F7 O  Q141 A
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-21 15:23 , Processed in 0.209461 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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