Код: Выделить всё
This line is used for testing.\nTesting testing testing.Код: Выделить всё
import java.util.List;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.IOException;
class Main {
public static void main(String[] args) {
List list = null;
try {
list = Files.readAllLines(Paths.get("path to txt file"));
} catch (IOException e) {
e.printStackTrace();
}
String[] Array = list.toArray(new String[list.size()]);
}
}
Я хочу, чтобы результат был таким:
Код: Выделить всё
This line is used for testing.Код: Выделить всё
Testing testing testing.