Java Scanner read String and convert to char array
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Please enter elements..."); char[] a = sc.next().toCharArray(); /*w ww . j a va 2s. c om*/ for (int i = 0; i < a.length; i++) System.out.println(a[i]); sc.close(); } }