Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void sumujIZapisz(String nazwaPliku) throws IOException{
- BufferedReader plik2 = null;
- FileWriter plik4 = null;
- int wynik=0;
- String l = "";
- int licznik=1;
- try {
- plik2 = new BufferedReader(new FileReader(nazwaPliku));
- while ((l = plik2.readLine()) != null) {
- System.out.println(l);
- wynik+=Integer.parseInt(l);
- }
- plik4=new FileWriter(nazwaPliku,true);
- wynik+=1;
- plik4.write("\r\n" + Integer.toString(wynik));
- } finally {
- if (plik2 != null) {
- plik2.close();
- }
- if (plik4 != null){
- plik4.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement