Java Programming Example of how to convert String into characters and display the characters

This program accepts the string from the keyboard and convert the string into characters and displays the characters.

import java.io.*;

/**
 *
 * @author JavaHotSpot
 */

public class stringtocharacter
{
  public static void main(String args[])
 {
     String s1;
     int length;
     char[] c;
     DataInputStream d;
     try
     {
     System.out.println("Enter the String");
     d=new DataInputStream(System.in);
     s1=(String)d.readLine();
     c=s1.toCharArray();
     System.out.println("The Characters are");
     for(int i=0;i<c.length;i++)
     {
         System.out.println(c[i]);
     }
     }
     catch(Exception e)
     {
         System.out.println(e.toString());
     }
 }
}

Output:
Enter the String
JavaHotSpot
The Characters are
J
a
v
a
H
o
t
S
p