I keep getting this error,
Exception in thread \"main\"java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds forlength 0
  atsimpleInheritance/simpInher.Dwelling$DriverTest.main(Dwelling.java:146)
Can someone help me fix it?
import java.io.BufferedReader;
  import java.io.FileNotFoundException;
  import java.io.FileReader;
  import java.util.*;
  import java.io.*;
  import java.io.FileWriter;
  import java.io.IOException;
  class Dwelling {
  /*
  Declaring Variables
  */
  String streetAddress;
  String city;
  String state;
  String zipCode;
  int bedrooms;
  double bathrooms;
 Â
  /*
     Getters and Setters for
     street address, city, state, zipcode,
     bedrooms, and bathrooms.
  */ Â
 Â
  public String getStreetAddress() {
     return streetAddress;
  }
 Â
  public void setStreetAddress(String streetAddress){
     this.streetAddress =streetAddress;
  }
 Â
  public String getCity() {
     return city;
  }
 Â
  public void setCity(String city) {
     this.city = city;
  }
 Â
  public String getState() {
     return state;
  }
 Â
  public void setState(String state) {
     this.state = state;
  }
 Â
  public String getZip() {
     return zipCode;
  }
 Â
  public void setZip(String zipCode) {
     this.zipCode = zipCode;
  }
 Â
  public int getBedrooms() {
     return bedrooms;
  }
 Â
  public void setBedrooms(int bedrooms) {
     this.bedrooms = bedrooms;
  }
 Â
  public double getBathrooms() {
     return bathrooms;
  }
 Â
  public void setBathrooms(double bathrooms) {
     this.bathrooms = bathrooms;
  }
 Â
  /*
  no arg constructor
  no parameters
  */
 Â
  public Dwelling() {
     /*
     Declaring Variables
     */
    Â
     streetAddress = \"\";
     city = \"\";
     state = \"\";
     zipCode = \"\";
     bedrooms = 0;
     bathrooms = 0.0;
  }
 Â
  public String toString() {
     return streetAddress + \"|\" + city +\"|\" + state +\"|\" +
           zipCode + \"|\" + bedrooms + \"|\" +bathrooms;
  }
  class House extends Dwelling{
     /*
     Declaring Variables
     */
     double acreage;
     int garageSize;
     /*
     no arg constructor
     no parameters
     */
     public House() {
        super();
        acreage =0.0;
        garageSize =0;
     }
     public String toString() {
        return(super.toString()+ \"|\" + acreage + \"|\" + garageSize);
     }
  }
 Â
  class Apartment extends Dwelling{
     /*
     Declaring Variables
     */
     String aptNum;
     boolean laundry;
    Â
     /*
     no arg constructor
     no parameters
     */
     public Apartment() {
        super();
        aptNum =\"\";
        laundry =false;
     }
     public String toString() {
        return(super.toString() + \"|\" + aptNum + \"|\" + laundry);
     }
  }
 Â
  public static class DriverTest{
     /*
     command line arguments
     */
    Â
     public static void main(String[]args) throws FileNotFoundException, IOException {
        File file = newFile(args[0]);
        BufferedReaderbuffReader = new BufferedReader(new FileReader(file));
       Â
        System.out.print(\"Print output 1\");
        ArrayList listOfLines = new ArrayList <>();
       Â
        String line =buffReader.readLine();
       Â
        Dwelling d1[] =new Dwelling[5];
        int i = 0;
       Â
        while (line !=null && i<5) {
           d1[i] = new Dwelling();
           d1[i].setStreetAddress(line);
           line = buffReader.readLine();
           d1[i].setCity(line);
           line = buffReader.readLine();
           d1[i].setState(line);
           line = buffReader.readLine();
           d1[i].setZip(line);
           line = buffReader.readLine();
           int bed = Integer.parseInt(line);
           d1[i].setBedrooms(bed);
           line = buffReader.readLine();
           d1[i].setBathrooms(Double.parseDouble(line));
           listOfLines.add(d1[i]);
           i++;
          Â
           line = buffReader.readLine();
           line = buffReader.readLine();
           line = buffReader.readLine();
           line = buffReader.readLine();
        }
        buffReader.close();
       Â
        for(Dwellingdwl: listOfLines) {
           /*
           Prints data in the console
           */
           System.out.println(dwl);
        }
        FileWriter write= new FileWriter(file);
       Â
        for(Dwellingstr: listOfLines) {
           /*
           Writes data into the file
           */
           write.write(str + System.lineSeparator());
        }
        write.close();
     }
 Â
 Â
 Â
  }
 Â
}