Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1.  
  2. // kontrollin ega nimes pole numbreid
  3. public static String ainultT2hed(String input) throws IOException {
  4.  
  5. Scanner sisestus = new Scanner(System.in);
  6. if (!input.matches("\\d+")) {
  7. return input;
  8. }
  9. while (true) {
  10. if (input.matches("\\d+")) {
  11. System.out.println("Nimes ei tohi numbreid olla!");
  12. System.out.println("Proovige uuesti!");
  13. }
  14. System.out.println("Sisetage enda ees- ja perekonnanimi");
  15. String nimi = sisestus.nextLine();
  16. if (!nimi.matches("\\d+")) {
  17. return nimi;
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement