It's because the subclass has visibility of private for the void func() method, but the superclass has visibility public.
If your code was allowed to compile, it would explode at runtime if you did this:
parent p = new TestClass();
p.func(); // boom - func is public in parent, but TestClass's impl is private, so no access would be allowed
To "fix" this, make the subclass's func method public:
public class TestClass extends parent {
...
public void func() { // give it public visibility
System.out.println("in child");
}
}
And please use standard naming conventions; in this case "classes should start with a capital letter" - i.e Parent not parent