I switched from C++ to Java and have a problem with nested classes. I would like to initiate an instance of a subclass in the constructor of the superclass. I tried it like this, but it seems to be wrong.
public class Aircraft {
public class LandingGear {
}
public Aircraft() {
Aircraft.LandingGear myLandingGear = this.new LandingGear();
}
}
The idea is that every instance of the class Aircraft has an instance "myLandingGear" of the subclass LandingGear.
has an instance of. This doesn't need to be an inner class. But Aircraft need to have a variable of this class[<>]toolbar button) are for runnable in-browser examples using JavaScript, HTML, and/or CSS, not Java. For Java, just use a simple code block (the{}toolbar button).