Answer the question
In order to leave comments, you need to log in
Why, when inheriting a class, I cannot see the variable, although it is with the protected modifier?
class Math{
protected static final double PI = 3.14;
}
class SubMath extends Math{
Math.PI; // выдает ошибку
}
Answer the question
In order to leave comments, you need to log in
Because only declarations can be in the body of a class, and instructions should only be in the body of methods.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question