Content
stackoverflow Products O search… Java Multiple Inner Classes Asked today Modified today Viewed 31 times Home PUBLIC 4 Questions Tags Users Companies COLLECTIVES Explore Collectives TEAMS Stack Overflow for Teams – Start collaborating and sharing organizational knowledge. 2 Free -2 class Af class B String s "X"; class B extends A String s "Y"; class A extends B X public class Main public static void main(String1 args) B b new B(); orints Y System.out.printin(b.s); prints X System.out.println(b.new A().s); Crosto S froc Tosm Why Teams? I really can not understand why the B obiect acts different in this situations. What exaclv happening in the "System.out.printin(b.new AO.s);" part? Can you please explain, thank vou all. java oop inner-classes Share Edit Follow Flag asked 57 mins ago byyavuzyigit I New contributor Sorry, but code like this should be taken out back and shot – Hovercraft Full of Eels 56 mins ago