We can use the method , charAt() , to extract the word in the string.
for example:
try
{
BufferedReader in = new BufferedReader(new FileReader("test.txt"));
String str;
str = in.readLine();
for(int i=0 ; i<str.length() ; i++)
{
System.out.println( charAt(i) );
}
}
catch (IOException e)
{
System.out.println(e);
}
全站熱搜