FileReader fileReader =new FileReader("file\\first.txt");
BufferedReader bufferedReader =new BufferedReader(fileReader);
StringBuilder stringBuilder =new StringBuilder();
List<String> strings =new ArrayList<>();
String str=null;
while ((str=bufferedReader.readLine())!=null) {
System.out.println(str);
if (str.trim().length()>2) {
strings.add(str);
}
System.out.println(strings.size());
for (int i = 0; i < strings.size(); i++) {
System.out.println(strings.get(i));
}
}
BufferedReader bufferedReader =new BufferedReader(fileReader);
StringBuilder stringBuilder =new StringBuilder();
List<String> strings =new ArrayList<>();
String str=null;
while ((str=bufferedReader.readLine())!=null) {
System.out.println(str);
if (str.trim().length()>2) {
strings.add(str);
}
System.out.println(strings.size());
for (int i = 0; i < strings.size(); i++) {
System.out.println(strings.get(i));
}
}