Results 1 to 3 of 3
Thread: NullPointerException
- 05-16-2012, 04:10 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 16
- Rep Power
- 0
NullPointerException
Hi guys, so I'm getting this error in my program. I'm getting a NullPointerException on this code:
I've got a class with the name Player, and I even tried calling two of the methods inside of it just to test, and they gave me the desired result. So I don't get it guys, why am I getting an error when I'm trying to add the Player variables p to the ArrayList players?Java Code:p = new Player(team, i); players.add(p);
- 05-16-2012, 05:03 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
Re: NullPointerException
Move to New To Java
We have no clue based upon what you posted. What is null on the line that throws the Exception? Add some println's to find out.
- 05-16-2012, 06:36 PM #3
Similar Threads
-
NullPointerException
By jayragz in forum NetBeansReplies: 5Last Post: 05-12-2011, 05:19 PM -
NullPointerException
By maxspyderweb in forum New To JavaReplies: 5Last Post: 03-02-2011, 10:42 AM -
Nullpointerexception?
By Pulgo in forum New To JavaReplies: 5Last Post: 01-05-2011, 04:05 PM -
NullPointerException
By JohnST in forum New To JavaReplies: 13Last Post: 01-06-2010, 12:37 AM -
NullPointerException
By tommyyyy in forum New To JavaReplies: 9Last Post: 03-26-2009, 10:51 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks