G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 6th, 2020 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class Filesystest {
  5.     File f = new File("test.txt");
  6.     List<String> file = new ArrayList<>();
  7.     String Docname;
  8.     PrintWriter pw = null;
  9.    
  10.     void Docnm () {
  11.         Scanner name = new Scanner(System.in);
  12.         Docname = name.nextLine();
  13.     }
  14.    
  15.     void FWrite() {
  16.         String name = Docname;
  17.         try {
  18.             FileWriter FWriter = new FileWriter("test.txt", true);
  19.             pw = new PrintWriter(FWriter);
  20.             pw.println(name);
  21.             pw.close();
  22.         }
  23.         catch(Exception e) {
  24.             System.out.println("error Write");
  25.         }
  26.     }
  27.    
  28.     void Freader() {
  29.         try {
  30.            
  31.             Scanner Fread = new Scanner(f);
  32.            
  33.             while(Fread.hasNext()) {
  34.                 file.add(Fread.next());
  35.             }
  36.             Fread.close();
  37.         }
  38.         catch (Exception e) {
  39.             System.out.println("error read");
  40.         }
  41.     }
  42.    
  43.    
  44.     void showALl () {
  45.         for (int i = 0; i<file.size(); i++) {
  46.             System.out.printf("%s", file.get(0));
  47.         }
  48.     }
  49.    
  50.     void SearchFile () {
  51.         for (int i=0; i<file.size(); i++) {
  52.             if (file.get(i) == file.get(3)) {
  53.                 System.out.println("file found :" + file.get(i));
  54.             }
  55.         }
  56.     }
  57.    
  58.    
  59.     //dont work
  60.     /*void RemoveFile () {
  61.         for (int i=0; i<file.size(); i++) {
  62.             if (file.get(i) == file.get(3)) {
  63.                 System.out.println("file deleted :" + file.get(i));
  64.                 file.remove(i);
  65.             }
  66.         f.delete();
  67.         File x = new File("test.txt");
  68.         for (int z=0; z<file.size(); z++) {
  69.             pw.println(file.get(z));
  70.         }
  71.         }
  72.     } */
  73.     void ReplaceFile () {}
  74. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top