Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 19, 2022 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/4d3642f1371e382e838ef3db6990cd5f to your computer and use it in GitHub Desktop.
Save parzibyte/4d3642f1371e382e838ef3db6990cd5f to your computer and use it in GitHub Desktop.
private static String solicitarPalabra() {
Scanner sc = new Scanner(System.in);
while (true) {
System.out.println("Ingresa la palabra: ");
String palabra = sc.nextLine();
if (palabra.indexOf(" ") != -1) {
System.out.println("No puedes ingresar una frase");
} else if (palabra.length() < 10) {
System.out.println("La longitud mínima es de 10");
} else {
return palabra;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment