So using the following code:
try (BufferedReader br = new BufferedReader(new FileReader("Program10.txt")))
{
String sCurrentLine;
String[] splits;
            
while ((sCurrentLine = br.readLine()) != null) 
{
splits = sCurrentLine.split("\\s+");
}
}
catch (IOException e) 
{
e.printStackTrace();
}
System.out.println(splits); // prints as null
I've read the file, Program10.txt, by line to get:
[1000  31000  3 Texas, 
1042  12180.06  3 Texas, 
1062  13240.45  2 Texas, 
1200  36000  2 Maryland, 
1327  19800.56  2 Alaska, 
1483  22458.23  7 Texas, ...
]
And I'm hoping to print the entire line when the income (so the second element is greater than average income, which is 5,037) with the following code (***I suspect the problem is with the bolded code):
ArrayList<Household> households = new ArrayList<Household>();
**// This will create new household object
Household household = new Household(
Integer.parseInt(splits[0]), 
Double.parseDouble(splits[1]), 
Integer.parseInt(splits[2]), 
splits[3]);
I'm getting a null Exception in thread "main" java.lang.NullPointerException at Program10.readFile(Program10.java:129) (line 129 corresponds to the code "Integer.parseInt(splits[0]), "
Is there something obvious I'm missing here?
