package org.example; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { File file = new File("data.txt"); if (file.createNewFile()) { System.out.println("File created: " + file.getName()); } else { System.out.println("File already exists!"); } FileWriter fileWriter = new FileWriter("data.txt",true); fileWriter.write("Id;Name;Note" + "\n"); fileWriter.write("1;Jakub;Právě učím PVA" + "\n"); fileWriter.write("2;Pavel;Právě učím HWS" + "\n"); fileWriter.close(); Scanner scan = new Scanner(file); while (scan.hasNextLine()) { String row = scan.nextLine(); String[] strings = row.split(";"); System.out.println("Id je: " + strings[0] + " a jméno je " + strings[1] + " a poznámka je " + strings[2]); //System.out.println(row.substring(6,8)); } } }