• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with Static Vector  RSS feed

 
Pratik Khetia
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am designing a chat server and to keep track of the user that are logged on. I am using a class which has static method and a static Vector. But when I pass the argument from other program this static Vector gives an error...
"java.lang.NullPointer"
or if I initialise the vector then I lose the traack of the users as everytime it stores in a new instance of the Vector.
So if anyone has any idea...I would look forward to get some help
thanks
Pratik Khetia
 
Aleksey Matiychenko
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you have to initialize the vector once. So how about putting something like this before accessing a vector
if (static_vector == null)
static_vector = new Vector();
... continue using vector

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!