A
Andreas Leitgeb
I'm somewhat surprised by a behaviour I didn't expect.
The situation is as follows:
class Z.A is static private and defines static meth().
class Z.B is static public and inherits class Z.A.
class Y inherits class Z.B, and shouldn't be able to
know it's own grandpa Z.A.
But still, Y can call its grandpa's static meth().
SSCCE: Z.java: (but run class Y)
public class Z {
private static class A {
public static void meth() {System.out.println("Hello, World! A"); }
}
public static class B extends A { }
}
class Y extends Z.B {
public static void main(String[]a){ Y.meth(); }
}
The situation is as follows:
class Z.A is static private and defines static meth().
class Z.B is static public and inherits class Z.A.
class Y inherits class Z.B, and shouldn't be able to
know it's own grandpa Z.A.
But still, Y can call its grandpa's static meth().
SSCCE: Z.java: (but run class Y)
public class Z {
private static class A {
public static void meth() {System.out.println("Hello, World! A"); }
}
public static class B extends A { }
}
class Y extends Z.B {
public static void main(String[]a){ Y.meth(); }
}