public class Session implements Runnable, Clonable{ public void run ();public Object clone () ; }
public class Session extends Runnable, Cloneable { public void run() {/*dosomething*/} public Object clone() {/*make a copy*/} }
public abstract class Session implements Runnable, Clonable { public void run() {/*do something*/} public Object clone() {/*make a copy*/} }
public class Session implements Runnable, implements Clonable { public void run() {/*do something*/} public Object clone() {/*make a copy*/} }
第1题:
下列关于Test类的定义中,正确的是______。
A) class Test implements Runnabte{
public void run(){}
public void someMethod(){}
B) class Test implements Rnuuable{
public void run();
}
C) class Test implements Rnuuable{
public void someMethod();
}
D) class Test implements Rnuuable{
public void someMethod();{}
}
A.
B.
C.
D.
第2题:
在下面程序的下画线处应填入的选项是 public class Test______{ public static void main(String args[]) { Test t=new Test(); Thread tt=new Thread(t); tt.start(); } public void run() { for(int i=0;i<5;i++) System.out.println("i="+i); } }
A.implements Runnable
B.extends Thread
C.implements Thread
D.extends Runnable
第3题:
下面程序创建了一个线程并运行,请填空,使程序完整。
public class ThreadTest {
public static void main (String[] args) {
Hello h=Hew Hello ();
【 】
t.start ();
}
}
class Hello implements Runnable {
int i;
public void run () {
while(true) {
System.out.println("Hello" +i++);
if(i==5) break;
}
}
}
第4题:
class MyThread extends Thread { public void run() { System.out.println(“AAA”); } public void run(Runnable r) { System.out.println(“BBB”); } public static void main(String[] args) { new Thread(new MyThread()).start(); } } What is the result?()
第5题:
( 30 )在程序的下划线处应填入的选项是
public class Test _________{
public static void main(String args[]){
Test t = new Test();
Thread tt = new Thread(t);
tt.start();
}
public void run(){
for(int i=0;i<5;i++){
system.out.println( " i= " +i);
}
}
}
A ) implements Runnable
B ) extends Thread
C ) implements Thread
D ) extends Runnable
第6题:
下列哪个方法可用于创建一个可运行的类? ( )
A.public class X implements Runable {public void run(){...,.,}}
B.public class X implements Thread {public void run(){......}}
C.public class X implements Thread {public int run(){……}}
D.public class X implements Runable {protected void run(){.....}}
第7题:
下列关于Test类的定义中,正确的是( )。
A.class Test implements Runnable{ public void run{} Dublic void someMethod[]{} }
B.class Test implements Runnable( puIblic void run; }
C.class Test implements Runnable( Dublic void someMethod[]; }
D.class Test implements Runnable( public void someMethod{} }
第8题:
通过实现Rmmable接口创建线程,请在下面横线处填写代码完成此程序。
public class ThreadTest
{
public static void main(String args [])
{
Thread testObj1 = new Thread (new Hello ());
Thread testObj2 = new Thread (new Hello ());
testObj 2.start ( );
}
}
class Hello implements Runnable
{
int j;
public void run()
{
System.out.println("Hello" + j ++);
}
}
第9题:
public class SomeException { } Class a: public class a { public void doSomething() { } } Class b: public class b extends a { public void doSomething() throws SomeException { } } Which is true about the two classes?()
第10题:
interface Data { public void load(); } abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?()