填空题
创建一个名为MyPackage的包的语句是
【2】
。
【参考答案】
package MyPackage;
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
下列程序的运行结果是______。 Class C14 implements Runnable private int i; public C14(int n) this.i = n; public void run) try Thread.currentThread().sleep(i); catch(InterruptedException ie) System.err.println(ie.tString()); System. out.println( 线程 + Thread.currentThread() .getName + 睡眠了 + i + 毫秒结束 ); public class Testl4 public static void main(String[] args) Thread t = new Thread(new C14(300), t ); t.start();
A.线程t睡眠了300毫秒结束
B.线程Thread-0睡眠了300毫秒结束
C.线程t睡眠了i毫秒结束
D.线程Thread-0睡眠了i毫秒结束
点击查看答案&解析
单项选择题
下列程序的运行结果是______。 class A implements Runnable int a; iht i = 2; A(int x) a = x; public void run() while(i > 0) System.out.println( 线程 + a); i--; public class Testl3 public static void main(String[] args) Thread a1 = new Thread(new A(1)); Thread a2 = new Thread(new A(2)); a1.start(); a2.start();
A.线程1
线程1
线程2
线程2
B.线程1
线程2
C.线程1
线程2
线程1
线程2
D.线程1
线程1
线程1
线程1
点击查看答案&解析
相关试题
Applet生命周期包括Applet的创建、运行和 ...
【9】 方法用于更新图形。它首先清除背景...
【7】 布局管理器将组件一排一排地依次放...
从Component类派生出来的 【8】 类用于...
程序中可能出现一种情况:多个线程互相等待...