Glad you figured it out.
Type: Posts; User: Norm
Glad you figured it out.
What is the statement that throws the NPE? You need to find the variable with null value!!!
What is the value of indata when the code in post#20 is executed?
What is the value of the val variable? That is the only thing that would cause a NPE with statement you posted.
What is the code at the line where the exception occurs?
Can you post the full text of the error message.
Edit your post and change the tags to
<YOUR CODE HERE> to get highlighting
You get to the elements of an array by using an index value inside of []s
words[0] is a reference to the first element in the words array.
The elements of an array are items of the same class as...
Add some printlns to the code to show the value of variables as they are set and changed.
The words array now has the split strings in it. You will need a loop to get them out one by one and do the conversion on each of them.
How did you use the split method? It returns an array that you must then go into to get the strings that were split from the original string.
After you have read in the String that you want to split.
You need to get the individual words from the String so you can work on them one by one.
Then you can change them and build a new String with the changed words.
The String class has methods to...
Can you post the output from when the code does not work that shows the problem.
Add comments saying what is wrong with the output and show what the output should be.