Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Gruppenarbeit_Aufgabe2 {
- public static void main (String [] args) {
- eingabeKey();
- }
- public static String eingabeKey () {
- Scanner sc = new Scanner(System.in);
- System.out.println("Schlüssel eingeben");
- String eingabe = sc.nextLine();
- String kleinerText = eingabe.toLowerCase();
- if (eingabe.equals(kleinerText) && eingabe.length() == 8 && eingabe.matches ("[a-z]+") ) {
- char [] ar = eingabe.toCharArray();
- System.out.println();
- for (int i = 0; i < ar.length; i++)
- {
- System.out.print(ar[i]);
- }
- }
- else {
- System.out.println("kein korrekter Schlüssel");
- }
- sc.close();
- return eingabe;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement