Can we reduce the visibility of the overridden method how
Answers
Answered by
0
Answer:
No we can not.
Explanation:
Let's say a
class Parent {
public void func() {
System.out.println("in Parent");
}
}
public class Child extends Parent {
private void func() {
System.out.println("in child");
}
}
Parent p = new Child ();
p.func();
If your code was allowed to compile, it would explode at runtime if you did this:
Similar questions