Given:
1. abstract class abstrctIt {
2. abstract float getFloat ();
3. }
4. public class AbstractTest extends AbstractIt {
5. private float f1= 1.0f;
6. private float getFloat () {return f1;}
7. }
What is the result?
A. Compilation is successful.
B. An error on line 6 causes a runtime failure.
C. An error at line 6 causes compilation to fail.
D. An error at line 2 causes compilation to fail.

解决方案 »

  1.   

    C. An error at line 6 causes compilation to fail.
    Cannot reduce the visibility of the inherited method from AbstractIt
      

  2.   

    CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      

  3.   

    为什么啊,abstract 这个东西
      

  4.   

    因为你父类getFloat这个方法是默认访问权限!但是你子类却是private,小于父类权限,改成public就好了!跟抽象没什么关系!