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.

variable might not have been initialized!!

I keep getting this error message with this code and I don't understand what it's telling me! Do I need to sort of merge the two chatter methods?

.\Chatter.java:96: error: variable name might not have been initialized
}^1 error

And that is the whole error. it points towards the } which is closing the final method (public Chatter).

I would really appreciate if someone could help me with this, I also get the feeling that I will need to change a method in another class which uses this one once this problem has been resolved..

The Code

publicclass Chatter implementsRunnable{/**
* The name of the Chatter.
* This should be the ID chosen by the remote user on joining
* the chatroom.
* This value is set in the constructor.
*
*/publicfinalString name;publicvoid run(){}/**
* Creates a new <code>Chatter</code> instance with a given name.
* This constructor implements operation newChatter in the
* <a href="chatroom.maude">Chatter specification</a>.
*
* @param n the name for this Chatter
*/public Chatter(String n){
name = n;}/**
* Return the {@link #name name} of the Chatter.
* This method implements operation getName in the
* <a href="chatroom.maude">Chatter specification</a>.
*
* @return the {@link #name name} of the Chatter
*/publicString getName(){return name;}/**
* Send a message across the network to the remote user.
*
* @param msg the msg to be sent
*/publicvoid sendToUser(String msg){}
Chatter theChatter;/**
* Pointer to the tail of the list.
* Default scope modifier, so that this field can be efficiently
* accessed in class ChatterList.
*
*/
Chatter next;/**
* Creates a new <code>ChatterNode</code> instance.
*
* @param c the Chatter at this node
* @param next the tail of this list
*/public Chatter(Chatter c, Chatter next){this.next= next;
theChatter = c;}}