So lets say i have this class call A which has a constructor of
A(String someA, int someB , String[] someC)
and in another class i created a main which has this as a class variable
private static String[] someC = new String[4];
private static ArrayList<A> thisA;
then i extract some information from a dat file
someA= readFile.nextLine(); //some normal string such as bob Billy
someB= readFile.nextInt(); //some integer like 5
unitCode[0] = readFile.next(); //some code such as HITHERE34
unitCode[1] = readFile.next(); // all the 4 is the same style
unitCode[2] = readFile.next();
unitCode[3] = readFile.next();
thisA.add(new A(someA,someB,unitCode); // create object and store into array list
I tried running this and it gave me a nullPointerException error when i print the unitCode it returns me an address instead . how do i fix this ?
thisA?