Null Pointer Exception Help !!
Hi all, I've been doing some java programing, I created a tester class for a project and when i try to output something to the terminal window i get a 'null pointer exception', any help would be appreciated, many thanks.
Tester Code To Show All Details
System.out.println("Prints all details" + c1.getAllClubInfo().toString());
*method getAllClubInfo() uses the getAllRallies() Method below
The null pointer exception points to the 'getAllRallies()' Method in the Club class
public String getAllRallies ()
String r = "";
for (int index = 0; index < allRallies.size(); index++)
Rally m = allRallies.get(index);
r += m.getAsString();
Re: Null Pointer Exception Help !!
Recommend you post more code to demonstrate the problem (preferably an SSCCE). NullPointerExceptions are thrown when a variable as not been initialized: based upon the code you posted make sure the variable allRallies has been created and does not contain null elements