Please excuse me if this question has been asked before. I have searched around the web and here at stack overflow.
Case:
I am stuck at my java project and the compiler won't compile my project when I try to use an inner class inside another.
Code:
public class outer {
public class middle {
public class inner {
public int variable = "8";
}
}
}
Declaration:
I am trying to declare the classes like this:
outer outerObject = new outer();
outerObject.middle middleObject = outerObject.new middle();
outerObject.middleObject.inner innerObject = outerObject.middleObject.new inner();
Compilation results:
source\start.java:8: error: cannot find symbol
outerObject.middleObject.inner innerObject = outerObject
.middleObject.new inner();
^
Any reply would be much appreciated! Wether my intentions are impossible or if I am simply doing something wrong.
Have a nice day!