Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Replace {
- public static void main(String[] args) {
- File res=new File("D:\\App\\Eclipse IDE\\Matrix\\src\\core\\New.java");
- File st=new File("D:\\App\\Eclipse IDE\\Matrix\\src\\core\\Matrix.java");
- String s="";
- try {
- FileReader fr = new FileReader(st);
- FileWriter fw = new FileWriter(res);
- Scanner scan=new Scanner(fr);
- while(scan.hasNext()){
- s=scan.nextLine();
- s.replace("public", "private");
- fw.append(s);
- fw.flush();
- }
- fr.close();
- fw.close();
- scan.close();
- } catch (IOException e) {
- System.err.println("ошибка файла: " + e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement