So lesen Sie die Textdatei als Variable in Java
public static void readAsString() {
String lCurentDir = System.getProperty("user.dir")+"/aa.txt";
FileReader fr;
try {
fr = new FileReader(lCurentDir);
BufferedReader br = new BufferedReader(fr);
String s="";
s=br.readLine();
System.out.println(s);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
buddhi