网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
public class Threads3 implements Runnable {  public void run() {  System.out.print(”running”);  }  public static void main(String[] args) {  Thread t = new Thread(new Threads3());  t.run();  t.run();  t.start();  }  }  What is the result?()
A

 Compilation fails.

B

 An exception is thrown at runtime.

C

 The code executes and prints “running”.

D

 The code executes and prints “runningrunning”.

E

 The code executes and prints “runningrunningrunning”.


参考答案

参考解析
解析: 暂无解析
更多 “单选题public class Threads3 implements Runnable {  public void run() {  System.out.print(”running”);  }  public static void main(String[] args) {  Thread t = new Thread(new Threads3());  t.run();  t.run();  t.start();  }  }  What is the result?()A  Compilation fails.B  An exception is thrown at runtime.C  The code executes and prints “running”.D  The code executes and prints “runningrunning”.E  The code executes and prints “runningrunningrunning”.” 相关考题
考题 下面程序创建了一个线程并运行,请填空,使程序完整。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;}}}

考题 通过实现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 ++);}}

考题 下列关于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.

考题 下列哪个方法可用于创建一个可运行的类? ( )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(){.....}}

考题 在下面程序的下画线处应填入的选项是 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 RunnableB.extends ThreadC.implements ThreadD.extends Runnable

考题 下列关于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{} }

考题 下列程序通过实现Runnable接口创建一个线程,选择正确的语句填入程序的横线处。 class MyRun implements Runnable { String str; MyRun(String s) { str = s; } public void run() System.out.println(str); } } public class ex40 { public static void main(String[] args) { String name = "实现阶段Runnable 接口"; MyRun my = new MyRun(name); Thread th = th. start ( ); } }A.new MyRun(my)B.new Thread()C.new Thread(my)D.Thread(my)

考题 ( 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;i5;i++){system.out.println( " i= " +i);}}}A ) implements RunnableB ) extends ThreadC ) implements ThreadD ) extends Runnable

考题 public class Threads3 implements Runnable {  public void run() {  System.out.print(”running”);  }  public static void main(String[] args) {  Thread t = new Thread(new Threads3());  t.run();  t.run();  t.start();  }  }  What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 The code executes and prints “running”.D、 The code executes and prints “runningrunning”.E、 The code executes and prints “runningrunningrunning”.

考题 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?()  A、 AAAB、 BBBC、 Compilation fails.D、 The code runs with no output.

考题 public class Foo implements Runnable (  public void run (Thread t) {  system.out.printIn(“Running.”);  }  public static void main (String[] args)  {  new thread (new Foo()).start();  } )   What is the result?()      A、 An exception is thrown.B、 The program exists without printing anything.C、 An error at line 1 causes compilation to fail.D、 An error at line 2 causes the compilation to fail.E、 “Running” is printed and the program exits.

考题 interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

考题 下列代码正确的是哪项?() A、 public class Session implements Runnable, Clonable{   public void run ();public Object clone () ; }B、 public class Session extends Runnable, Cloneable {  public void run() {/*dosomething*/}       public Object clone() {/*make a copy*/} }C、 public abstract class Session implements Runnable, Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}        }D、 public class Session implements Runnable, implements Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}       }

考题 Which method must be defined by a class implementing the java.lang.Runnable interface? () A、 void run()B、 public void run()C、 public void start()D、 void run(int priority)E、 public void run(int priority)F、 public void start(int priority)

考题 现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?() A、 public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }B、public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }C、public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }D、public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }

考题 现有:  class ThreadBoth extends Threaa implements Runnable  {      public void run()  (System.out.print("hi");  }     public static voicl main (String  []  args)  {     Thread tl=new ThreadBoth():      Thread t2 = new Thread (tl):     tl.run():      t2.run():     }          结果为:()      A、 hi hiB、 hiC、编译失败D、运行时异常被抛出

考题 public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()A、 public class Circle implements Shape { private int radius; }B、 public abstract class Circle extends Shape { private int radius; }C、 public class Circle extends Shape { private int radius; public void draw(); }D、 public abstract class Circle implements Shape { private int radius; public void draw(); }E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

考题 单选题public class Threads3 implements Runnable {  public void run() {  System.out.print(”running”);  }  public static void main(String[] args) {  Thread t = new Thread(new Threads3());  t.run();  t.run();  t.start();  }  }  What is the result?()A  Compilation fails.B  An exception is thrown at runtime.C  The code executes and prints “running”.D  The code executes and prints “runningrunning”.E  The code executes and prints “runningrunningrunning”.

考题 单选题Which method must be defined by a class implementing the java.lang.Runnable interface? ()A  void run()B  public void run()C  public void start()D  void run(int priority)E  public void run(int priority)F  public void start(int priority)

考题 单选题下列代码正确的是哪项?()A  public class Session implements Runnable, Clonable{   public void run ();public Object clone () ; }B  public class Session extends Runnable, Cloneable {  public void run() {/*dosomething*/}       public Object clone() {/*make a copy*/} }C  public abstract class Session implements Runnable, Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}        }D  public class Session implements Runnable, implements Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}       }

考题 单选题现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?()A  public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }B public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }C public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }D public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }

考题 单选题interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?()A  public class Employee extends Info implements Data { public void load() { /*do something*/ } }B  public class Employee implements Info extends Data { public void load() { /*do something*/ } }C  public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D  public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E  public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F  public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

考题 单选题class ThreadBoth extends Thread implements Runnable {  public void run(){ System.out.print("hi "); }  public static void main(String [] args){  Thread t1 = new ThreadBoth();   Thread t2 = new Thread(t1);  t1.run();  t2.run();  }  }  结果为:()A hiB hi hiC 编译失败D 代码运行,但无输出结果

考题 多选题Which two code fragments will execute the method doStuff() in a separate thread?()Anew Thread() {public void run() { doStuff(); }};Bnew Thread() {public void start() { doStuff(); }};Cnew Thread() {public void start() { doStuff(); }}.run();Dnew Thread() {public void run() { doStuff(); }}.start();Enew Thread(new Runnable() {public void run() { doStuff(); }}).start();

考题 多选题Which two code fragments will execute the method doStuff() in a separate thread?()Anew Thread() { public void run() { doStuff(); } }Bnew Thread() { public void start() { doStuff(); } }Cnew Thread() { public void start() { doStuff(); } } .run();Dnew Thread() { public void run() { doStuff(); } } .start();Enew Thread(new Runnable() { public void run() { doStuff(); } } ).run();Fnew Thread(new Runnable() { public void run() { doStuff(); } }).start();

考题 单选题现有:  interface Animal {       void eat () ;       }       //insert code here       public class HouseCat extends Feline {       public void eat() { }       }  和五个申明  abstract class Feline implements Animal { }  abstract  class  Feline  implements  Animal  {  void eat () ;  }  abstract class Feline implements Animal { public void eat();}  abstract class Feline implements Animal { public void eat() {}  }  abstract class Feline implements Animal { abstract public void eat();} 结果为:()A 1B 2C 3D 4

考题 单选题现有:  class ThreadBoth extends Threaa implements Runnable  {      public void run()  (System.out.print("hi");  }     public static voicl main (String  []  args)  {     Thread tl=new ThreadBoth():      Thread t2 = new Thread (tl):     tl.run():      t2.run():     }          结果为:()A  hi hiB  hiC 编译失败D 运行时异常被抛出

考题 单选题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?()A  AAAB  BBBC  Compilation fails.D  The code runs with no output.