Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4.  
  5. public class Replace {
  6.     public static void main(String[] args) {
  7.         File res=new File("D:\\App\\Eclipse IDE\\Matrix\\src\\core\\New.java");
  8.         File st=new File("D:\\App\\Eclipse IDE\\Matrix\\src\\core\\Matrix.java");
  9.         String s="";
  10.         try {
  11.             FileReader fr = new FileReader(st);
  12.             FileWriter fw = new FileWriter(res);
  13.             Scanner scan=new Scanner(fr);
  14.             while(scan.hasNext()){
  15.                 s=scan.nextLine();
  16.                 s.replace("public", "private");
  17.                     fw.append(s);
  18.                     fw.flush();
  19.             }
  20.             fr.close();
  21.             fw.close();
  22.             scan.close();
  23.             } catch (IOException e) {
  24.             System.err.println("ошибка файла: " + e);
  25.             }
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement