Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void ecriturefichier(String str) throws IOException {
- String ch;
- Scanner sc = new Scanner (System.in);
- System.out.println("donner votre chaine de caractéres :");
- ch=sc.nextLine();
- PrintWriter pw = null;
- try {
- pw = new PrintWriter(new BufferedWriter(new FileWriter(str)));
- do {
- pw.println(ch);
- ch=sc.nextLine();
- } while(!(ch.equals("fin")));
- } finally {
- if (null != fw) fw.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement