+ 3

I'm trying to learn how to read/write a file in java

Anyone who could give me a basic exemple of how to read a double and write it to another file? I'm a bit stuck

5th Mar 2017, 6:39 PM
Catalin Dervesteanu
Catalin Dervesteanu - avatar
1 Respuesta
+ 1
try (BufferedReader br=Files.newBufferedReader (Paths.get ("your path");BufferedWriter bw=Files.newBufferedWriter (Paths.get("your other path"))){String in=br.readLine (); int i=Integer.parseInt (in); //do stuff bw.write (Integer.toString (i)); }catch (IoException|NumberformatException e){ //error handling }
6th Mar 2017, 5:59 AM
No One
No One - avatar