《Java程序设计实用教程实验指导、实训与习题解析》 《Java程序设计》模拟试题D及评分标准
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
《Java程序设计》模拟试题D及评分标准
一、填空题(每空1分,共10分)
1.Java应用程序Java小程序
2.TCP Socket UDP Socket
3.临界资源临界区
4.同步互斥
5..java .class
二.选择题(每题2分,共50分)
B C D B D
B D B A C
B C A C A
C B C C A
A A A D D
三.程序阅读填空题目(第题6分,共24分)
1. 3
2. (1) 10 (2) 20 (3) 10
3. (1) void (2) x++ (3) m*=x
4. (1) new Font (2) new Font (3) new Font
(4) coloraction (5) coloraction1 (6)coloraction2
四、程序设计题(16分)
class subThread1 implements Runnable //线程1
{
Thread thread1=new Thread(this,"1");
public void run() //重写run()方法,输出1~26
{
System.out.println("线程:"+thread1.getName()+"开始运行!");
for(int i=1;i<=26;i++)
{
System.out.println(i);
try
{
thread1.sleep(100);
}
catch(InterruptedException e)
{
System.out.println("线程1异常");
}
}
}
}
class J02_Runnable implements Runnable //线程2
{
Thread thread2=new Thread(this,"2");
public void run() //重写run()方法,输出A~Z
{
System.out.println("线程:"+thread2.getName()+"开始运行!");
for(char ch='A';ch<='Z';ch++)
{
System.out.println(ch);
try
{
thread2.sleep(10);
}
catch(InterruptedException e)
{
System.out.println("线程2异常:");
}
}
}
public static void main(String[] args)
{
Thread thread1=new Thread(new subThread1()); //开始线程1
thread1.start();
Thread thread2=new Thread(new J02_Runnable()); //开始线程2
thread2.start();
}
}。