Home > Net >  How to inherit a List from a parent class from a child class in java
How to inherit a List from a parent class from a child class in java

Time:04-04

How to inherit a List from a parent class from a child class ? this is parents Class code

public class PageList extends Page {
    protected List<String> LectureName = new ArrayList<String>();

}

and this one is child class

public class Connect extends PageList{
   // try to check it pass 
   protected void GetConnection(){
   for(int i =0;i<7;i  ){
          System.out.println(LectureName.get(i));
   }
  }
}

but it doesn't works. why i can't inherit a List from parent class?

CodePudding user response:

Since you neglected to define "it doesn't work", we cannot diagnose your problem. I could guess you have a problem because of the instantiated list being empty (not populated). No way to know for sure.

But to answer your larger question…

  •  Tags:  
  • java
  • Related