import java.util.Scanner; public class Program01 { public static void main(String[] args) throws Exception { String name = inputName(); System.out.println(name); } public static String inputName() { Scanner sc = new Scanner(System.in); System.out.print("Név: "); String name = sc.nextLine(); boolean goodName = true; if (name.length()<1) goodName = false; if (!name.matches("[a-zA-záéíóöőúüűÁÉÍÓÖŐÚÜŰ]+")) goodName = false; if (!goodName) { System.exit(1); } return name; } }