title: get method returns null array when invoked form anther class . It results nullPointerException
body: <p>I keep getting NullPointerException when I try to access array elements from another class using the get method. My code uses a constructor to initialize the array, and it works just fine.</p>
  
  <p>MagazineValue.class</p>
  
  <pre><code>public class MagazineValue {
  
  public MagazineValue(){
  }
  private String[]magazineName;
  public MagazineValue(String[] magazineName){
  
  
      this.magazineName = new String[magazineName.length];
      System.arraycopy(magazineName, 0, this.magazineName, 0,
      magazineName.length);
  
  }
  
  public String[] getMagazineName(){
      return magazineName;
  }
  }
  </code></pre>
  
  <p>The constructor here copy's array value from the argument to a private array variable.
  When I try to invoke getMagazineName() from another class, it shows that the array is still null. Is there any way I can solve this? It sure seems easy but it took me a lot of time. </p>
  
  <p>FirebaseValueListner.class</p>
  
  <pre><code>public class FirebaseValueListner {
  public void setMagazineName(){
      String[]magazineName={"African Daily" , "African Bussines", "African Women"};
      MagazineValue setValue= new MagazineValue(magazineName);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The FirebaseValueListner gets values from the Firebase database and saves it values to an ArrayList and later copy's the values to arrays.
  The arrays are passed to the constructor of the MagazineValues.</p>
  
  <p>LibraryFragment.class `</p>
  
  <pre><code>public class LibraryFragment {
  
  public static void main(String[] args) {
      // TODO Auto-generated method stub
      String[]magazineName;
      MagazineValue getMagazineName;
      getMagazineName=new MagazineValue();
  
      magazineName=getMagazineName.getMagazineName();
      System.out.println("Magazine Name : " +magazineName[1]);
  
  
        }
  
      }
  </code></pre>
  
  <p>`</p>