Which two declarations prevent the overriding of a method? ()
A: Final void methoda(){}
B: Void final methoda(){}
C: Static void methoda(){}
D: Static final void methoda(){}
E: Final abstract void methoda(){}
A: Final void methoda(){}
B: Void final methoda(){}
C: Static void methoda(){}
D: Static final void methoda(){}
E: Final abstract void methoda(){}
举一反三
- 在方法声明时,不能使用的关键字是()。 A: static、final、public B: abstract、void、final C: class、void、final D: static、abstract、final
- 请说出下列程序的输出结果_____________,_____________。import java.io.IOException;public class E {public static void main(String args[]){try { methodA();}catch(IOException e){System.out.print("你好");return;}finally {System.out.println("thanks");}}public static void methodA() throws IOException{throw new IOException();}}
- 下列方法中,属于抽象方法的是( )。 A: final void method(){…} B: static void method(){…} C: abstract void method(){…} D: abstract void method();
- abstract class BaseClass { public virtual void MethodA() { } public virtual void MethodB() { } } class Class1: BaseClass { public void MethodA(string arg){ } public override void MethodB(){ } } class Class2: Class1 { new public void MethodB(){ } } class MainClass { public static void Main(string[] args) { Class2 o = new Class2(); Console.WriteLine(o.MethodA()); } } 请问,o.MethodA调用的是 A: BaseClass.MethodA B: Class2.MethodA C: Class1.MethodA D: 都不是
- 给出下列程序的输出结果。import java.io.IOException;public class E {public static void main(String args[]){int m =10;try {methodA();m = 100;}catch(IOException e){m = 1000;}System.out.println(m);}public static void methodA() throws IOException{throw new IOException();}}