Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Null Pointer Exception Help !!

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Thanked 0 Times in 0 Posts

    Default 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();
    return r;

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default 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

Similar Threads

  1. Null Pointer Exception Help!!
    By puzzledstudent in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 11th, 2010, 06:46 PM
  2. [SOLVED] Null Pointer Exception
    By musasabi in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 11th, 2010, 09:25 PM
  3. HttpURLConnection null pointer exception
    By chopficaro in forum Java Theory & Questions
    Replies: 0
    Last Post: May 10th, 2010, 10:19 AM
  4. Null pointer exception
    By Wrathgarr in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 23rd, 2010, 12:48 AM
  5. Null Pointer Exception
    By MysticDeath in forum Exceptions
    Replies: 2
    Last Post: October 24th, 2009, 01:49 PM

Tags for this Thread