I am getting the following errors. Exception in thread "main" java.lang.NullPointerException at ReadFile.createDogs(ReadFile.java:41) at ReadFile.main(ReadFile.java:55) The file is opening to the desktop. I feel I am missing something very simple. I have included the class file also. The error is specific to dogOutput.println(dogInfo);
Thank you.
    import java.io.*;
    import java.io.PrintWriter;
    public class ReadFile
    {
    private static Canine[] getCanine()
    {
    Canine[] canines= new Canine[5];
    canines[0]=new Canine("Thoedore", "Male", "Medium",  7, 50);
    canines[1]=new Canine("Magellan", "Male", "Medium",  5, 50);
    canines[2]=new Canine("Duffy", "Male", "Small",  10, 10);
    canines[3]=new Canine("Sammie", "Female", "Medium",  7, 65);
    canines[4]=new Canine("Snowball", "Male", "Small",  13, 17);
    return canines;
    }
    private static PrintWriter createFile(String fileName)
    {
        try{
            File listOfDogs = new File(fileName);
            PrintWriter  infoToWrite= new PrintWriter
                                       ( new BufferedWriter
                                            (new FileWriter(listOfDogs)));
           }
        catch (IOException e)
           {
            System.out.println(" An I/O Error Occurred.");
            System.exit(0);
           }
           return null;
    }
       private static void createDogs(Canine dog, PrintWriter dogOutput)
       {
        String dogInfo= dog.name + " " + dog.gender+ " " + dog.size +" ";
       dogInfo += Integer.toString(dog.age)+ " "+ 
         Double.toString(dog.weight);
        dogOutput.println(dogInfo);
        }
    public static void main (String[] args)
    {
       Canine[] canines= getCanine();
       System.out.println("Here1");
         PrintWriter dogOutput = 
          createFile("/Users/Teacher/Desktop/Dogs.text");
       for(Canine dogs: canines)
       {
           createDogs(dogs, dogOutput);
           System.out.println("Here5");
       }
       dogOutput.close();
    }
   private static class Canine extends Pet
   {
   public static final String type="Dog";
    public Canine()
    {
    super.type=this.type;
    }
    public Canine(String name, String gender, String size,  int age, double 
     weight)
    {
    super.type=this.type;
    super.name=name;
    super.gender=gender;
    super.size=size;
    super.age=age;
    super.weight=weight;
    }
    public static void setType(String word)
    {
    }
   }
    private static class Pet
    {
    public static String type;
    public static String color;
    public static String gender;
    public static String temperment;
    public static String food;
    public static int age;
    public static double weight;
    public static String name;
    public static String size;
    public Pet()
    {
    }
    public Pet(String type,String color,String gender,String temperment,
    String food,int age,double weight,String name,String size)
    {
        type=type;
        color=color;
        gender=gender;
        temperment=temperment;
        food=food;
        age=age;
        weight=weight;
        name=name;
        size=size;
    }
    public Pet(String name, String gender, String size,  int age, double 
     weight)
    {
        name=name;
        gender=gender;
            size=size;
            age=age;
            weight=weight;
    }
    public static String getType()
    {
        return type;
    }
    public static String getName()
    {
        return name;
    }
    public static String getSize()
    {
        return size;
    }
    public static String getColor()
    {
        return color;
    }
    public static String getTemperment()
    {
        return temperment;
    }
    public static String getFood()
    {
        return food;
    }
    public static String getGender()
    {
        return gender;
    }
    public static int getAge()
    {
        return age;
    }
    public static void setType(String word)
    {
        type=word;
    }
    public static void getName(String word)
    {
        name=word;
    }
    public static void setSize(String word)
    {
        size=word;
    }
    public static void setColor(String word)
    {
        color=word;
    }
    public static  void getTemperment(String word)
    {
        temperment=word;
    }
    public static void setFood(String word)
    {
        food=word;
    }
    public static void setGender(String word)
    {
        gender=word;
    }
    public static void setAge(int ageSet)
    {
        age=ageSet;
    }
    public static void setWeight(double weightSet)
    {
        weight=weightSet;
    }
    public static void setName(String NameSet)
    {
        name=NameSet;
    }
    public  String toString()
    {
        return ("Type "+type+"\n" +" Name "+name+"\n"+" Age "+age+"\n"+ 
   "Size "+ size+"\n"+" Gender "+gender+"\n"+" Weight "+weight);
      }
     }
    }
 
     
    