Exercise 3: Write a Java program that generates a password randomly. The program asks the user to enter the length of the password and generates randomly an alphanumeric password with the specified length.You have to define and call a method generatePassword() which takes an integer parameter (n) and prints a random password (character by character using SecureRandom class) of length n following this pattern:
Generate 2 random letters, then
Generate 1 random digit
Hints: Numerical representations of:
a)Letters: start from ‘a’=97 to ‘z’=122
b)Digits: start from ‘0’=48 to ‘9’=57
Examples:
Run 1 Password length = 5 Password = et7ar
Run 2 Password length = 9 Password = fh6hv7cz2.
'');">
تحميل الصورة
الأجوبة
success
تم تقديم إجابتك بنجاح
success
تم تعديل الإجابة، سيتم نشرها بعد مراجعة الإدارة