62,614
社区成员
发帖
与我相关
我的任务
分享
import java.io.*;
public class TestFileInputStream {
public static void main(String [] args) {
FileInputStream fis = null;
int c = 0;
int num = 0;
try {
fis = new FileInputStream("E://JAVA//2009//09//123.txt");
while((c=fis.read())!=-1) {
num++;
System.out.print((char)c);
}
System.out.println("\n"+"Read "+num+" byte .");
fis.close();
}
catch(FileNotFoundException e) {
System.out.println("File not found !"+e.toString());
}
catch(IOException e) {
System.out.println("Read file error !"+e.toString());
}
}
}
public class Test4{
public static void main(String[] args)throws Exception{
char c = '中';
byte b[] = "中".getBytes();
System.out.println(b.length);
}
}