设为首页 加入收藏

TOP

中兴公司计算机专业应届生笔试试卷(09)(二)
2014-11-23 21:52:08 来源: 作者: 【 】 浏览:12
Tags:中兴 公司 计算机 专业 应届 笔试 试卷
int meth2(){


return 2;


}


public int meth3(){


return 3;


}


public int meth4(){


return 4;


}


}



class Jkou{


public static void main(String args[]){


JC j = new JC();


System.out.println(j.meth1());


System.out.println(j.meth2());


System.out.println(j.meth3());


System.out.println(j.meth4());


}


}


A、4 3 2 1


B、1 2 3 4


C、1 3 2 4


D、1 4 2 3


B



6、如果一个Java Applet源程序文件只定义有一个类,该类的类名为MyApplet,则类MyApplet必须是 类的子类并且存储该源程序文件的文件名为


Applet(2分)、MyApplet(2分)



7. 以下程序的执行结果是( ) D(3分)


class A


{


public int n;


public String str;


}



class B


{


public A[] a;


public B() { a = new A[10]; }


}



class Test


{


public static void main( String[] args )


{


B b = new B();


b.a[0].n = 1;


b.a[0].str = “2″;


System.out.println( b.a[0].str + b.a[0].n );


}


}



A. 编译错误 B. 21


C. 3 D. 产生NullPointerException


E. 产生ClassCastException



8. 多线程有几种实现方法,都是什么 同步有几种实现方法,都是什么 (10分)


多线程有两种实现方法,(1分)分别是继承Thread类(2分)与实现Runnable接口 2分)


同步的实现方面有两种,(1分)分别是synchronized,wait(2分)与notify(2分)



9. 按照下图写出代码。(18分)




Public class JCheckbocDemo{


Public static void main(String agrs[]){


Container con = new JFrame(“JCheckBox演示窗口”);


Panel panel1= new Panel();


Panel panel2= new Panel();


ButtonGroup sex = new ButtonGroup(); //定义性别单选框


JRadioButton box1 = new JRadioButton(“男”,true);


JRadioButton box2 = new JRadioButton(“女”,false);



sex.add(box1);


sex.add(box2);


panel1.add(box1);


panel2.add(box2);



JCheckBox box3 = new JCheckBox(“计算机”,false); //定义系别复选框


JCheckBox box4 = new JCheckBox(“英语”,true);


panel2.add(box3);


panel2.add(box4);


myframe.setSize(300,300);



con.setLayout(new BoxLlayout(con,BoxLayout.Y_AXIS)); //设置窗体布局


con.add(new Label(“性别选择:”));


con.add(panel1);


con.add(new Label(“系别选择:”));


con.add(panel2);


myframe.show();


}


}


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇数据网操作系统维护及网络安全工.. 下一篇项目经理面试题_项目经理面试必看..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: