Converting a String into a array.
I'm working on a program right now where I need to convert a String into an array. I thought I got it working, but I keep having runtime errors.
This is the coding I have so far:
phrase = keyboard.next();
String userPhrase = new String;
userPhrase = phrase.split("");
If the "user" enters something without spaces (for ex. ABA) it works fine, but if it has spaces I keep getting errors.
I'm assuming I don't have the correct parameters when calling the split method? But I'm having a hard time figuring out what I need to put in place of the quotation marks. If someone could point me in the right direction I would appreciate it.
Playing in my bit box ...
yeah... sounds fun ... did it with "for" loop, two variables and 4 lines of code (made it as a method).