i'm trying to create a method that adds a certain object into an array of inherited objects.
public class Biblio {
Biblio[] Tab; static int i=0;
Biblio();
void insert(Biblio O){Tab[i]=O;i++;}}
in the main class, i created 3 objects of classes that extend from each others: means Document extends from Biblio, Article extends from Document, Book extends from Article.
public class TestBiblio {
public static void main(String[] args) {
Document A= new Document();
Article B= new Article();
Book C= new Book();
Biblio D= new Biblio();
D.insert(A);
D.insert(B);
D.insert(C);}}
Once i run the code, i get Exception in thread "main" java.lang.NullPointerException error. i'm a beginner in java, i couldn't find out hat went wrong..