java零碎知识点整理

System.out.println((char)97);//a


InputStream有:read() , read(byte[] a) , read(byte[] a, int offSet ,int length)

Reader         有:read(),read(char[] a)   ,read(char[] a,int offSet,int length)

OutputStream:    write(int b), wirte (byte[] b),wirte(byte[] b,int offSet, int length)

Wirter            有:wirte(int b),write(char[] b),wirte(char[] b,int offSet,int length),write(String s),write(String s,int offSet,int length)

Writer类的write(String string)方法自动调用String类的 toCharArray()方法,然后调用write(char[] c)。 

详情查看《尚学堂java SE学习笔记》


BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
try {
System.out.println(reader.read());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

输入:0 则返回的是48


BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
try {
System.out.println((char)reader.read());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

输入:0 则返回的是0







你可能感兴趣的:(java零碎知识点整理)