日新月异
5
公司 :杭州神话信息技术有限公司
部门 :运营中心设计部
岗位 :UI视觉设计
8
关注
15
粉丝
7030
微博
56
被赞
新浪微博
原创达人
友情链接:
找感兴趣的人
精彩内容
热门应用
关于我们
手机玩微博
注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。
______
interface MyInterface
{
public abstract void print(int n);
}
class Mythread extends Thread ______ MyInterface
{
public void run()
{
for(int i = 0; i < 10; i++)
this.print(i);
}
public void print(int n)
{
System.out.print(n +" ");
}
}
public class Example1_6
{
public static void main(String argv[])
{
Mythread th = new Mythread();
______
}
}
正确答案:①package example;②implements③th.start();①package example;②implements③th.start(); 解析:MyInterface是自定义的一个接口,Mythread继承于Thread类同时实现了 MyInterface。主方法先根据Mythread生成一个线程,然后将其启动。第1个空,题目中已经说明要将本程序打包到 example包,则说明要使用关键字“package”。第2个空,接口是抽象方法和常量的结合,是一种特殊的抽象类,接口必须通过“i