[Solved] derived class not needing some of the parent methods or attributes


I’m not quite sure what you are trying to do with this. But I think this will clear up the things for you.

public class Course{
  private String course = "CS101";
}


public class FinishedCourse extends Course{

  public void displayCourse(){

    System.out.println(super.course); //compilation error. 
    //You cannot access private variables even if it is in direct parent class
  }
}

solved derived class not needing some of the parent methods or attributes