Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///
- List<String> words = new ArrayList<String>();
- BufferedReader reader = new BufferedReader(new FileReader("words.txt"));
- String line;
- while ((line = reader.readLine()) != null) {
- words.add(line);
- }
- reader.close();
- -----------------------------------------------------------------------
- BufferedReader in = null;
- List<String> myList = new ArrayList<String>();
- try {
- in = new BufferedReader(new FileReader("myfile.txt"));
- String str;
- while ((str = in.readLine()) != null) {
- myList.add(str);
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (in != null) {
- in.close();
- }
- }
- -------------------------------------------------------------------------------------------------------------------
- ---------------------------------ARRRAY EXAMPLE -------------------------------------------------------------------
- BufferedReader in = new BufferedReader(new FileReader("path/of/text"));
- String str;
- while((str = in.readLine()) != null){
- String[] arr = str.split(" ");
- for(int i=0 ; i<str.length() ; i++){
- arr[i] = in.readLine();
- }
- }
- PrintWritter
- BufferedReader reader = new BufferedReader(new FileReader(file));
- String line = null;
- while(s=br.readline()!=null) {
- PrintWriter fs = new PrintWriter(new FileWriter(file));
- fs.println(s);
- }
- ------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement