It is telling me In the static block, all lines from the file named FILE_NAME must be added separately to the List lines.
I am adding them separately.
package com.codegym.task.task15.task1525;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
File in a static block
*/
public class Solution {
public static List<String> lines = new ArrayList<>();
static {
try{
FileReader x = new FileReader(Statics.FILE_NAME);
BufferedReader reader = new BufferedReader(x);
String currentLine = reader.readLine();
while (currentLine != null){
lines.add(currentLine);
}
reader.close();
}
catch(IOException e){
}
}
public static void main(String[] args) {
System.out.println(lines);
}
}