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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 2 of 2

Thread: null pointer exception

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default null pointer exception

    HTML Code:
    public class Selection {
    
    private Vector<Cue> cuevalues; // vector of Cues
    
    
    public Selection()
    {
    	int count = 0;
    	System.out.println("I AM HERE");
    	
    while (count < 16)
    {
    	System.out.println("I AM HERE YO");
    	Cue cue1 = new Cue(PrintColumns.cuevalue(count), count);
    	System.out.println("I AM HERE jeez");
    	cuevalues.add(cue1);
    	System.out.println("I AM HERE please");
    	count++;
    	System.out.println("I AM HERE " + count);
    }
    
    }
    I am running this code through the constructor and am getting a null pointer exception when adding a Cue object into a vector of Cues.

    Does anyone know why this could be happening?

    Obvos forget the Printlines.

    Thanks


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: null pointer exception

    You didn't initialize cuevalues

Similar Threads

  1. [B]Null Pointer Exception[/B]-- Please Help!!!
    By entwicklerin in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 24th, 2012, 11:24 AM
  2. Help with null pointer exception
    By Dr.HughMan in forum Exceptions
    Replies: 35
    Last Post: November 30th, 2011, 09:00 PM
  3. Null Pointer exception
    By Demetrius82 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 2nd, 2011, 07:32 PM
  4. Null Pointer Exception Help!!
    By puzzledstudent in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 11th, 2010, 06:46 PM
  5. Null Pointer Exception
    By MysticDeath in forum Exceptions
    Replies: 2
    Last Post: October 24th, 2009, 01:49 PM