Attempting to assign weaker access privileges Error in Java
Attempting to assign weaker access privileges Error in Java As per the rule in overriding , you cannot apply weaker access specifier over a stronger access specifier.Suppose , your parent class has a method Display() with stronger access specifier like Public , then you cannot use weaker access specifier like private or public when you are overriding the Display() method. Note :- Public is the 1st stronger access specifier Protected is the 2nd stronger access specifier Default is the 3rd stronger access specifier Private is the most weaker access specifier Always keep in mind about the access specifiers has vital role in inheritance (OOPS concept). Example :- /* * @Author Manoj * */ class AccessTest{ protected void display(){ //Stronger Access specifier System.out.println("Hello AccessTest:Display"); } } class TestWithMain extends AccessTest{ ...