Hi All,
Consider the following code snippet
package p1;
public abstract class test {
abstract void chuckde();
public abstract void onceMore();
protected abstract void tettt();
}
2nd class:
package p2;
import p1.test;
public class Test2 extends test{
@Override
public void onceMore() {
// TODO Auto-generated method stub
}
}
the above code will not compile for a very obvious reason: Test2 MUST implement the abstract method chuckde from test, but it cant since the method has a default access and is not visible to Test2 which is in a different package.
I am forced to make the class abtract. If that is the case, i would never have a concrete class in a different package if it inherits test. Why is this allowed? Why doesnt the compiler crib like it does when i create a private abstract method?
Thanks,
--Ajay
Consider the following code snippet
package p1;
public abstract class test {
abstract void chuckde();
public abstract void onceMore();
protected abstract void tettt();
}
2nd class:
package p2;
import p1.test;
public class Test2 extends test{
@Override
public void onceMore() {
// TODO Auto-generated method stub
}
}
the above code will not compile for a very obvious reason: Test2 MUST implement the abstract method chuckde from test, but it cant since the method has a default access and is not visible to Test2 which is in a different package.
I am forced to make the class abtract. If that is the case, i would never have a concrete class in a different package if it inherits test. Why is this allowed? Why doesnt the compiler crib like it does when i create a private abstract method?
Thanks,
--Ajay
Comment