You called the test() method in the constructor of the parent class, so that test() will be called when new is created. However, you did not call the test2() method, and there will definitely be no output. This is the basics of Java. in principle. You can write like this and there will be output. public Base{ test(); test2(); }
It would be better to directly copy the code for your question instead of taking screenshots. Because your code does not call the test2 method from beginning to end. It only calls the test method on line 5. You can write it on line 6test2();
You called the test() method in the constructor of the parent class, so that test() will be called when new is created. However, you did not call the test2() method, and there will definitely be no output. This is the basics of Java. in principle. You can write like this and there will be output.
public Base{
test();
test2();
}
It would be better to directly copy the code for your question instead of taking screenshots.
Because your code does not call the test2 method from beginning to end. It only calls the test method on line 5. You can write it on line 6
test2();
Why should it be output if there is no call? ? ?
You have not called the test2 method of the parent class, so there will be no output.
test2() is not called in subclasses and categories, this really cannot be output