Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package graficos;
- public class ContraAleatoria {
- public static void main(String[] args) {
- String[] letras = { "a", "b", "c", "d", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
- "t", "u", "v", "w", "x", "y", "z" };
- int[] numeros = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- System.out.print("su contraseña es: ");
- int a = 0;
- while (a < 8) {
- int selector = (int) (Math.random() * 10);
- System.out.print(letras[selector] + numeros[selector]);
- a++;
- }
- }
- }
- // La contraseña debe ser aleatoria y debe tener números y letras y debe tener una longitud de 8 digitos
Add Comment
Please, Sign In to add comment