ppp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Main.java 770B

1234567891011121314151617181920212223242526272829303132
  1. import java.io.InputStream;
  2. import java.util.Scanner;
  3. public class Main {
  4. public static void main(String[] args) {
  5. if(login(System.in)) {
  6. System.out.println("Hello World");
  7. }
  8. }
  9. public static boolean login(InputStream in) {
  10. Scanner s = new Scanner(in);
  11. for (int i = 0; i < 3; i++) {
  12. System.out.print("Benutzername: ");
  13. String login = s.next();
  14. System.out.print("Passwort: ");
  15. String passwort = s.next();
  16. Credentials cred = new Credentials(login, passwort);
  17. if (cred.valid()) {
  18. return true;
  19. }
  20. System.out.println("Du kommst hier nicht rein");
  21. }
  22. s.close();
  23. return false;
  24. }
  25. }