Java实现从ASCII码字符集到Unicode字符集之间的转换。

import java.io.*; 
class Input{
   public static void main(String args[]) throws IOException{
     byte buf [] = new byte[20];
       try{
         	System.out.println("please input data:");  
             System.in.read( buf );
 
        }catch(IOException e){
        System.out.println(e.toString());
}
       String str = new String (buf);  //把一个字节型数组转换成字符串数组
       System.out.println("you had input the data:\n"+str);  
   }
}

原创文章 66 获赞 39 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_44739495/article/details/103560384