关于char和int的问题# Java - 爪哇娇娃
c*n
1 楼
今天写程序碰到一个问题, 搞清楚了,
但是由此想到之前在这里问的为什么write()参数为int c问题, 故来讨论一下
用InputStream的read()来从文件中读字节
read
public abstract int read()
throws IOException
Reads the next byte of data from the input stream. The value byte is
returned as an int in the range 0 to 255. If no byte is available because the
end of the stream has been reached, the value -1 is returned. This method
blocks until input data is available, the end of the stream is detected, or an
exception is thrown.
这里读的是byte却用int的形式
但是由此想到之前在这里问的为什么write()参数为int c问题, 故来讨论一下
用InputStream的read()来从文件中读字节
read
public abstract int read()
throws IOException
Reads the next byte of data from the input stream. The value byte is
returned as an int in the range 0 to 255. If no byte is available because the
end of the stream has been reached, the value -1 is returned. This method
blocks until input data is available, the end of the stream is detected, or an
exception is thrown.
这里读的是byte却用int的形式