String program try File new File test char CB new char int length Read

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
String program;
try {
File f = new File("test");
char[] CB = new char[(int) f.length()];
Reader reader = new InputStreamReader(new FileInputStream(f), "UTF-8");
reader.read(CB);
program = new String(CB);
reader.close();
} catch (Exception ex) {
System.out.println(ex);
return;
}