Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // kontrollin ega nimes pole numbreid
- public static String ainultT2hed(String input) throws IOException {
- Scanner sisestus = new Scanner(System.in);
- if (!input.matches("\\d+")) {
- return input;
- }
- while (true) {
- if (input.matches("\\d+")) {
- System.out.println("Nimes ei tohi numbreid olla!");
- System.out.println("Proovige uuesti!");
- }
- System.out.println("Sisetage enda ees- ja perekonnanimi");
- String nimi = sisestus.nextLine();
- if (!nimi.matches("\\d+")) {
- return nimi;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement