Advertisement
Guest User

Untitled

a guest
May 29th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4. *
  5. * @author Moraisen
  6. */
  7. public class Main {
  8.  
  9. public static void main (String[] args) {
  10. System.out.println("Gib die richtige Zahl ein");
  11. Scanner sc = new Scanner(System.in);
  12. String eingabe = sc.nextLine();
  13. int wert;
  14. try {
  15. wert = Integer.parseInt(eingabe);
  16. }catch (Exception exc) {
  17. System.out.println("Bitte nur Zahlen eingeben");
  18. return;
  19. }
  20. int i = 5;
  21. if (wert == 5)
  22. {
  23. System.out.println("KOOREEKCT");
  24. }
  25.  
  26. else if (wert>5)
  27. {
  28. System.out.println("Wert zu groß");
  29. }else if (wert<5) {
  30. System.out.println("Wert zu klein");
  31. }
  32.  
  33.  
  34. }
  35.  
  36.  
  37. public static void main1 (String[] args) {
  38. System.out.println("Gib das Passwort ein!");
  39. Scanner sc = new Scanner(System.in);
  40. String zeile = sc.nextLine();
  41. if (zeile.equals("PENIS")) {
  42. System.out.println("Richtig!");
  43. }else {
  44. System.out.println("Falsch, geh Simons Popcorn klauen, dann geb ichs dir");
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement