BirdsHover

——路漫漫其修远兮,吾将上下而爬楼梯!

  BlogJava :: 首页 ::  :: 联系 :: 聚合  :: 管理 ::
  21 随笔 :: 8 文章 :: 34 评论 :: 0 Trackbacks
public class testclass {
    
public static void main(String[] args) throws IOException
    
{
        
byte[] buffer = new byte[1024];
        
int count = System.in.read(buffer);
        System.out.print(
new String(buffer,0,count,"gbk"));
    }

}

这样一段代码,在输入中文时,如果输入“ces”然后敲空格,得到“测试”这两个字,enter,然后输出
“ces测试”。

要是用Console运行,java testclass 则没有这种问题
posted on 2008-12-05 14:55 Birdshover 阅读(1008) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: