Java array inheritance not recognized by subclass : <p>I am working on a project where several classes have to inherit information. I am currently trying to get a subclass to inherit and work with an array from a superclass. The subclass isn't doing anything when I try to access the array. I can return the array after the information is read from the text file and placed into the array, but if I don't return it the subclass will do nothing with it.   </p>

<p>Superclass:</p>

<pre><code>package Objects;
import java.io.*;
import java.util.*;

public abstract class Shape{


    public static void main(String[] args) {


        String[] shape = new String[12];
        int i;

        BufferedReader reader; 

        try { 
            reader = new BufferedReader(new FileReader( 
            "src/Data.txt")); 
            String line = reader.readLine(); 
            while (line != null) { 
                for (i=0; i &lt; 13; i+=2) {
                shape[i] = line.substring(0, line.indexOf(" "));
                shape[i+1] = line.substring(line.length() - 1, line.length());
                line = reader.readLine();
        }
        }
         reader.close(); 
    } catch (IOException e) {
        e.printStackTrace(); 
    }
  catch(NullPointerException e) 
    { 
    } 

 }//end main
}//end shape
</code></pre>

<p>Subclass:</p>

<pre><code>package Objects;

import java.io.*;
import java.util.*;


public abstract class TwoDShape extends Shape{


        System.out.println(Arrays.toString(shape));

        public double getArea() {
            return 0.0;

    }
}//end 2D
</code></pre>
