niusouti.com

对于下列代码,叙述正确的是()。 interface Com{ int MAX=100; public void stop(); protected void start(); abstract void pause(); }A.int MAX=100; 会导致编译出错。B.public void stop(); 会导致编译出错。C.protected void start(); 会导致编译出错。D.abstract void pause(); 会导致编译出错。

题目

对于下列代码,叙述正确的是()。 interface Com{ int MAX=100; public void stop(); protected void start(); abstract void pause(); }

A.int MAX=100; 会导致编译出错。

B.public void stop(); 会导致编译出错。

C.protected void start(); 会导致编译出错。

D.abstract void pause(); 会导致编译出错。


相似考题
更多“对于下列代码,叙述正确的是()。 interface Com{ int MAX=100; public void stop(); protected void start(); abstract void pause(); }”相关问题
  • 第1题:

    下列______选项不是InputStream类中的方法。

    A.public abstract int read() throws IOException

    B.public final void writeInt (int V)throws IOException

    C.public int available() throws IOException

    D.public void close() throws IOException


    正确答案:B
    解析:选项B中的publicfinalvoidwriteInt(intv)throwsIOException方法是OutputStream类中的方法。

  • 第2题:

    下列哪个成员方法声明是正确的? ( )

    A.public abstract final int f(){...}

    B.public static boolean f(){...}

    C.static protected void g(a,{...}

    D.protected private number;


    正确答案:B
    解析:本题考查对成员方法声明的掌握程度。选项A错误,成员变量不能同时声明成abstract和final;选项B正确,声明了一个公有静态返回值类型是布尔类型的方法f();选项C错误,protected应在static之前;选项D错误,既不是方法声明,也不是正确的成员变量声明。

  • 第3题:

    下列哪个成员方法声明是正确的? ( )

    A.public abstract final int f(){…}

    B.public static boolean f(){…}

    C.static protected void g(a,b){…}

    D.protected private number;


    正确答案:B
    解析:本题考查对成员方法声明的掌握程度。选项A错误,成员变量不能同时声明成abstract 和 final;选项B正确,声明了一个公有静态返回值类型是布尔类型的方法 f();选项C错误,protected应在static之前;选项D错误,既不是方法声明,也不是正确的成员变量声明。

  • 第4题:

    Which will declare a method that is available to all members of the same package and be referenced without an instance of the class?()

    • A、 abstract public void methoda ();
    • B、 public abstract double inethoda ();
    • C、 static void methoda (double dl) {}
    • D、 public native double methoda () {}
    • E、 protected void methoda (double dl) {}

    正确答案:C

  • 第5题:

    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

  • 第6题:

    Object类的finalize()方法是如何声明的()。

    • A、public void finalize()
    • B、protected int finalize()
    • C、C.protected void finalize(int
    • D、protected void finalize()throws Throwable

    正确答案:D

  • 第7题:

    Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }  

    • A、Definition a.
    • B、Definition b.
    • C、Definition c.
    • D、Definition d.
    • E、Definition e.

    正确答案:B,C

  • 第8题:

    现有:  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*/}    }

    正确答案:B

  • 第9题:

    单选题
    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)


    正确答案: E
    解析: 暂无解析

  • 第10题:

    单选题
    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
    解析: 暂无解析

  • 第11题:

    单选题
    public class Parent{     public void change(int x){} }  public class Child extends Parent{     //覆盖父类change方法  }  下列哪个声明是正确的覆盖了父类的change方法?()
    A

     protected void change(int x){}

    B

     public void change(int x, int y){}

    C

     public void change(String s){}

    D

     public void change(int x){}


    正确答案: B
    解析: 暂无解析

  • 第12题:

    单选题
    Which will declare a method that is available to all members of the same package and be referenced without an instance of the class?()
    A

     abstract public void methoda ();

    B

     public abstract double inethoda ();

    C

     static void methoda (double dl) {}

    D

     public native double methoda () {}

    E

     protected void methoda (double dl) {}


    正确答案: B
    解析: 暂无解析

  • 第13题:

    下列程序片段中,能通过编译的是( )。

    A.public abstract class Animal{public void speak( );}

    B.public abstract class Animal{public void speak( ){};}

    C.public class Animal{pubilc abstract void speak( );}

    D.public abstract class Animal{pubile abstract void speak( ){};}


    正确答案:D
    Java中一个类是一个abstract类的子类,它必须具体实现父类的abstract方法。如果一个类中含有abstract方法,那么这个类必须用abstract来修饰(abstract类也可以没有abstract方法)。有abstract方法的父类只声明,由继承他的子类实现。所以选D。

  • 第14题:

    下列程序片段中,能通过编译的是( )。 A.public abstract class Animal{ public void speak;}S

    下列程序片段中,能通过编译的是( )。

    A.public abstract class Animal{ public void speak;}

    B.public abstract class Animal{ public void speak{);}

    C.public class Animal{ pubilc abstract void speak;}

    D.public abstract class Animal{ pubile abstract void speak{};}


    正确答案:A
    A。【解析】Java中一个类是一个abstract类的子类,它必须具体实现父类的abstract方法。如果一个类中含有abstract方法,那么这个类必须用abstract来修饰(abstract类也可以没有abstract方法)。有abstract方法的父类只声明,由继承它的子类实现。所以选A。

  • 第15题:

    Which will declare a method that is available to all members of the same package and can be referenced  without an instance of the class?()  

    • A、 Abstract public void methoda();
    • B、 Public abstract double methoda();
    • C、 Static void methoda(double d1){}
    • D、 Public native double methoda(){}
    • E、 Protected void methoda(double d1){}

    正确答案:C

  • 第16题:

    Which lines of code are valid declarations of a native method when occurring within the declaration of the following class?()    public class Qf575 {   // insert declaration of a native method here   }  

    • A、native public void setTemperature(int kelvin);
    • B、private native void setTemperature(int kelvin);
    • C、protected int native getTemperature();
    • D、public abstract native void setTemperature(int kelvin);
    • E、native int setTemperature(int kelvin) {}

    正确答案:A,B

  • 第17题:

    Which will declare a method that forces a subclass to implement it? () 

    • A、 Public double methoda();
    • B、 Static void methoda (double d1) {}
    • C、 Public native double methoda();
    • D、 Abstract public void methoda();
    • E、 Protected void methoda (double d1){}

    正确答案:D

  • 第18题:

    作为类中新线程的开始点,线程的执行是从()方法开始的。

    • A、public void start()
    • B、public void run()
    • C、public void int()
    • D、public static void main(Stringargs[])

    正确答案:A

  • 第19题:

    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)

    正确答案:B

  • 第20题:

    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 */ } }

    正确答案:B,E

  • 第21题:

    单选题
    现有:  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*/}    }


    正确答案: D
    解析: 暂无解析

  • 第22题:

    多选题
    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 */ } }


    正确答案: B,E
    解析: 暂无解析

  • 第23题:

    单选题
    现有      public class Parentt      public void change (int x){)     )      public class Child extends Parent{     //覆盖父类change方法     }      下列哪个声明是正确的覆盖了父类的change方法?()
    A

      protected void change (int x){}

    B

      public void change(int x,  int y){}

    C

      public void change (int x){}

    D

      public void change (String s){}


    正确答案: D
    解析: 暂无解析

  • 第24题:

    单选题
    现有:  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

    1

    B

    2

    C

    3

    D

    4


    正确答案: C
    解析: 暂无解析