Java 语言程序设计(一)
VIP题库
线程的结构都包含哪些部分,作用分别是什么?
用 Thread类的子类创建线程的过程是什么?
用 Thread类的子类创建一个线程并将其启动。
通过类_____可以创建和控制线程。
请说明创建线程两种方法的适用条件。
通过实现_____接口可以创建一个线程
阅读下列程序,请写出该程序的输出结果。public class Test35{public static void main(Stringl[] args){System.out.println("开始:");MyThread x=new MyThread(1000,"girl");MyThread y=new MyThread(300, "boy");x.start(); y.start();while(x.isAlive()||y.isAlive0());System.out.println("结束");}}class MyThread extends Thread{int dt;String name;public MyThread(int c,String n){dt=c; name =n; }public void run(){MyResourceClass.outMsg(this); }}class MyResourceClass{synchronized static void outMsg(MyThread th){System.out.println(th.name+" "+"启动.");for(int i=0;i<2;i++){System.out.println(th.name+" 第"+i+ 次活动.");try{Thread.sleep(th.dt);}catch(InterruptedException e){} }System.out.println(th.name+" "+"活动完成."); }} 阅读下列程序,请写出该程序的输出结果。
阅读下列程序,请回答以下问题: (1)当拖动滚动条滑块时,程序界面有什么变化? (2)滚动条的最小值是多少? (3)能从滚动条获得的最大值是多少?
请写出用Thread类的子类创建线程并启动线程所包含的步骤。
阅读下列程序,请写出该程序的功能。
«
1
2
3
4
5
6
7
8
...
50
51
»