In the following snippet:
static Scanner userInput = new Scanner(System.in);
static String str;
public static void main(String[] args) {
str = userInput.nextLine();
}
public String wordSplitter() {
char b;
for(int i = 0; i < numbers.length(); i += 1)
b = str.charAt(i);
return b;
}
the statement "return b;" gives me an error because my method should return a String, but b is a char.
So how do I somehow make b into a String? Or is there a better way to split Strings into letters of type String?
thanks