The YourKnowledgeTest.test() is private so YourExtensiveKnowledgeTest.test() is not overriding it. It is simply creating a method with the same name. Since your main() method is part of YourKnowledgeTest, you have access to the private method. Because you are assigning a reference to the YourExtensiveKnowledgeTest instance in a YourKnowledgeTest variable, the compiler only sees YourExtensiveKnowledgeTest as a YourKnowledgeTest and therefore calls the only
test() method it knows about (the private one).
Note that had you moved the main() method to YourKnowledgeTest then you would have gotten a compiler error because the compiler does not have access to the private method test().