I am creating a program that gets the seperate letters of a string entered by the user. I want to store my char information in a arraylist, but I am having some issues. Here is my code:
import java.util.*;
public class Main {
public static void main(String[] args) {
String input, output;
List<Character> characters = new ArrayList<Character>();
Scanner scanner = new Scanner(System.in);
System.out.print("Please type sentace to encode: ");
input = scanner.nextLine();
for(int i = 0; i < input.length(); i++) {
characters.add(input.charAt(i));
}
}
}
I have already searched to forums, as I originally put char instead of Character, but now I am getting an error and eclipse wants me to change the jdk to v1.5. What is the issue?