What is the problem: I don’t know how to save the data from the List to the .txt file. it saves the data correctly, I can refer to the List elements, they are displayed on the screen. But how to save the whole thing in a text file?
public static void parser() throws IOException { List<Neews> news = new ArrayList<>(); Document doc = Jsoup.connect("http://").get(); Elements trElements = doc.getElementsByAttributeValue("class", "con_title"); trElements.forEach(trElement -> { Elements elementsByClass = trElement.getElementsByClass("con_title"); String name = elementsByClass.get(0).text(); news.add(new Neews(name)); }); news.forEach(System.out::println); }