[quote name='mtxbass1']no. Let me give you a simple example.
String word = null;
System.out.println(word.length());
This would throw a null pointer exception.
String word = null;
word = "test";
System.out.println(word.length());
This wouldn't.
See the difference? You need to initialize trav in your code.
StringNode trav = null; declares the variable. It still must be initialized.[/QUOTE]
Ahh, I see.
What should I have it intialized to? After declaring it null, I set it equal to curr.
I'm just not sure if it's just pointing to the original str; or actually making a new copy. (what gets printed out now is "FINE")
String word = null;
System.out.println(word.length());
This would throw a null pointer exception.
String word = null;
word = "test";
System.out.println(word.length());
This wouldn't.
See the difference? You need to initialize trav in your code.
StringNode trav = null; declares the variable. It still must be initialized.[/QUOTE]
Ahh, I see.
What should I have it intialized to? After declaring it null, I set it equal to curr.
I'm just not sure if it's just pointing to the original str; or actually making a new copy. (what gets printed out now is "FINE")