Greetings once again.
After unsuccessfully
testing the following code, which in a sample example on paper, the answer is:
package Testing1;
public class E {
void printS1() {
System.out.println("F.printS1");
}
static void printS2() {
System.out.println("F.printS2");
}
}
class F extends E {
void printS1() {
System.out.println("F.printS1");
}
static void printS2() {
System.out.println("F.printS2");
}
public static void main(
String[] args) {
E x = new F();
x.printS1();
x.printS2(); // line with compile-time error message
}
}
Error message:
The static method printS1 from the type E should be acessed in a static way.
In Sierra Bates on page 103 it states at the top of the page that you can "use an object reference variable to access a static member".
Can someone help me with this?
Thank you,
Jerry B.