广中数通信息有限公司-移动服务支撑中心 J2EE笔试试题
JAVA软件工程师笔试题
应聘者: 职位: 答题时间: 考试时间:60分钟 选择题
一.选择题
1、下面哪些是java语言中的关键字? ( ) A. sizeof B. abstract C. NULL D. Native 2、下面语句哪个是正确的? ( )
A. char='abc';B. long l=oxfff;C. float f=0.23;D. double=0.7E-3; 3、以下程序测试String 类的各种构造方法,试选出其运行效果。( ) class STR{
public static void main(String args[]){ String s1=new String();
String s2=new String(\
char chars[]={'a',' ','s','t','r','i','n','g'}; String s3=new String(chars); String s4=new String(chars,2,6); byte bytes[]={0,1,2,3,4,5,6,7,8,9}; StringBuffer sb=new StringBuffer(s3); String s5=new String(sb);
System.out.println(\ System.out.println(\ System.out.println(\ System.out.println(\ System.out.println(\ } }
A. The String No.1 is
The String No.2 is String 2 The String No.3 is a string The String No.4 is string The String No.5 is a string B. The String No.1 is
The String No.2 is String 2 The String No.3 is a string The String No.4 is tring The String No.5 is a string C. The String No.1 is
The String No.2 is String 2 The String No.3 is a string The String No.4 is strin The String No.5 is a string
1
广中数通信息有限公司-移动服务支撑中心 J2EE笔试试题
D. 以上都不对
4、下面语句段的输出结果是什么?( ) int i = 9; switch (i) { default:
System.out.println(\ case 0:
System.out.println(\ break; case 1:
System.out.println(\ case 2:
System.out.println(\A. default
B. default, zero
C. error default clause not defined D. no output displayed
5、要串行化某些类的对象,这些类就必须实现 ( A ) A、Serializable接口 B、java.io.Externalizable接口 C、java.io.DataInput接口 D、DataOutput接口
二、不定项选择题(在每小题的五个备选答案中选出正确答案,并将正确答案的序号填入题干后面的括号内,错选多选,漏选均不得分。) 1、给出如下代码: class Test{
private int m;
public static void fun() { // some code... } }
如何使成员变量m 被函数fun()直接访问? A、将private int m 改为protected int m B、将private int m 改为 public int m C、将private int m 改为 static int m D、将private int m 改为 int m
2、下面哪几个函数是public void example(){...}的重载函数? A、 public void example( int m){...} B、public int example(){...} C、public void example2(){...}
D、 public int example ( int m, float f){...} 3、给出下面的代码段: public class Base{ int w, x, y ,z;
public Base(int a,int b) {
2
广中数通信息有限公司-移动服务支撑中心 J2EE笔试试题
x=a; y=b; }
public Base(int a, int b, int c, int d) {
// assignment x=a, y=b w=d; z=c; } }
在代码说明// assignment x=a, y=b处写入如下哪几个代码是正确的? A、 Base(a,b); B、x=a, y=b; C、x=a; y=b; D、this(a,b); 二、填空题
1. abstract的method是否可同时是static? ,是否可同时是native? ,是否可
同时是synchronized? 2. 字符串在函数的参数中是当成值传递还是引用传递, 3. char型变量中能不能存贮一个中文汉字? 4. 多线程有 2 种实现方法,分别是 。 5. 在JAVA中,如何跳出当前的多重嵌套循环? 6. jsp有哪些内置对象?
request,response,pageContext,session,application,out.config,page,exception 。 7. 在Web开发中需要处理HTML标记时,应做什么样的处理,要筛选那些字
符 。
8. 数据库中,表a和表b具有完全相同的结构,主键为 id。写出一个sql语句把表b中不存
在而表a中存在的数据查询出来:select * from a where a.id not in(select id from b); 。
9. 写一个sql语句把表b中不存在而表a中存在的数据插入到表b中去:
页面中有一个名称,ID 都为unitprice的type=text对象。如何判断输入的数据不能为空?