private void ioTest()
{
try
{
int intRead = -1;
while(intRead != '0')
{
intRead = System.in.read();
//System.out.println(intRead);
char a = (char)intRead;
System.out.println(a);
}
}
catch (IOException e)
{
e.printStackTrace();
}
}

解决方案 »

  1.   

    写了个粗糙的,只能基本满足你想输入字符串的愿望,因为我也是新手:)
    import javax.swing.*;
    public class Test
    {public static void main(String []args)
      { String astring=JOptionPane.showInputDialog("now you can input a string");
        System.out.println(astring);
        System.exit(0);
       }}
      

  2.   

    我觉得java核心技术这本书中的corejava包中的Console类编得挺好的,你不妨用它进行输入吧,方便,实用。它基本上解决了String , int , double 的输入. 网上有的down , 如果找不到的话,你发信息给我 , 告诉我 email 我发给你, 不过限在这两天 .
      

  3.   

    import java.io.*;
    public class CharInput { 
    public static void main (String args[]) throws java.io.IOException { 
     String s; 
     InputStreamReader ir; 
     BufferedReader in; 
     ir = new InputStreamReader(System.in); 
     in = new BufferedReader(ir); 
     while ((s = in.readLine()) != null) { 
     System.out.println("Read: " + s); 
     } 
     } 
    }
      

  4.   

    二楼的用了swing类的控件!他的这个也应该可以满足你的要求,而且运行正确(我编译过)