public class TestA{   public void methodA()  throws IOExcept

题目
单选题
public class TestA{   public void methodA()  throws IOException{   //……   }   }   public class TestB extends TestA{   public void methodA()  throws EOFException{   //……   }   }   public class TestC extends TestA{   public void methodA()  throws Exception{   //……   }   }   当编译类TestC的时候,结果是哪项?()
A

 正常

B

 编译错误

C

 运行错误

D

 以上都不对

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

使用jdbc 编写class EnrollmentImpl 实现接口 Enrollment:

public interface Enrollment{

public void createStudent(Student student) throws Exception;

pubic void createCourse(Course course) throws Exception;

public void enroll(Student student, Course course) throws Exception;

public void exam(Student, Course course, float grade) throws Exception;

}


正确答案:
 

第2题:

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

第3题:

下列哪个选项不是InputStream类中的方法?

A.public abstract int read()throws IOException

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

C.public void close()throws IOException

D.public int available() throws IOException


正确答案:B
解析:B中的public final void writeInt (int v)throws IOException方法是OutputStream类的方法。

第4题:

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

第5题:

public class TestA{    public void methodA() throws IOException{        //……    } }  public class TestB extends TestA{    public void methodA() throws EOFException{        //……   } }  public class TestC extends TestA{    public void methodA() throws Exception{        //……   } }  当编译类TestC的时候,结果是哪项?() 

  • A、 正常
  • B、 编译错误
  • C、 运行错误
  • D、 以上都不对

正确答案:B

第6题:

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?() 

  • A、 Compilation of both classes will fail.
  • B、 Compilation of both classes will succeed.
  • C、 Compilation of class a will fail. Compilation of class b will succeed.
  • D、 Compilation of class a will fail. Compilation of class a will succeed.

正确答案:D

第7题:

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

第8题:

下列______选项不是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类中的方法。

第9题:

Which two are valid declarations within an interface definition?() 

  • A、 void methoda();
  • B、 public double methoda();
  • C、 public final double methoda();
  • D、 static void methoda(double d1);
  • E、 protected void methoda(double d1);

正确答案:A,B

第10题:

class TestA {  public void start() { System.out.println(”TestA”); }  }  public class TestB extends TestA {  public void start() { System.out.println(”TestB”); } public static void main(String[] args) {  ((TestA)new TestB()).start();  }  }  What is the result?() 

  • A、 TestA
  • B、 TestB
  • C、 Compilation fails.
  • D、 An exception is thrown at runtime.

正确答案:B

更多相关问题