I have a code. This code splits multi-paragraph text with spaces or quotes. I want put the splitting parts into an array. But when I use that way, I get NullPointException error. What do you think about that?
arrays = null;
//arrays [k] = str.substring(j , (i)).trim() ;
//System.out.println(arrays [k]);
**The arrays and scan are defined above the main. When i try the ArrayList, i get output but it is multiple. For example: a b c d a b c d . . Multi-lines of same thing.
arraysisn't initialized anywhere, after its declaration. Unless it is required that you use arrays, you might use anArrayList, and when you exit the reading loop you can convert it to an array.