Today I had this evaluation question where I had to create two classes: Dress and TestClass. I finished up those classes but when I tried to run the program I got a NullPointerException message. Here are my classes:
Class Dress:
public class Dress {
    String colors []; 
    int sizes [];
    public Dress ( String colors [], int sizes []){
       this.colors = new String [colors.length];
       this.sizes = new int [sizes.length] ;
       this.colors = colors;
       this.sizes = sizes;
    }
    public boolean search (String color){
       for (int i =0; i<colors.length;i++)
           if (colors [i].equals(color))
              return true;
       return false;
    }
    public boolean search (int size){
       for (int i =0; i<sizes.length;i++)
           if (sizes [i] == size)
              return true;
       return false;
    }
}
Class Tests:
public class Tests {
    public static void main (String args []){
       String color[] = {"Pink","Blue","Red"};
       int size[] = {8,9,7};
       Dress d = new Dress (color, size);
       System.out.println(d.search("Pink"));
       System.out.println(d.search(8));
    }
}
 
     
    