多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

Given the following code, write a line of code that, when inserted at the indicated location, will make the overriding method in Extension invoke the overridden method in class Base on the current object.   class Base {   public void print( ) {   System.out.println("base");   }   }   class Extention extends Base {   public void print( ) {   System.out.println("extension");   // insert line of implementation here   }   }   public class Q294d {   public static void main(String args[]) {   Extention ext = new Extention( );   ext.print( );   }   }   Fill in a single line of implementation.()

正确答案:super.print();
答案解析:
进入题库查看解析

微信扫一扫手机做题