You may go through Generate a One Time Password or Unique Identification URL article before this for better understanding.
Many a times we forget our passwords and we opt for Forget password option and within no time we get a new password at our registered email-ID or phone no. to login our account. And every time we get a different password.
Sometime we access our bank accounts while shopping from an online store or many more ways, in order to verify our transition from the bank account they send us OTP(One Time Password) on our registered phone no. or our email-ID, within no time.
The following code explains how to generate such Passwords and OTP within no time and what code we can use if in case we need to do so.
Java program explaining the generation of Password
Note : The password we are generating will change every time. As we have used random() method to generate the password.
Generating password using random() : Your new password is : KHeCZBTM;-
Java program explaining the generation of OTP(One Time Password)
The OTP we are generating will change every time. As we have used random() method to generate the OTP.
Generating OTP using random() : You OTP is : 5291
This article is contributed by Mohit Gupta 🙂. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Recover password of password protected zip file
- Generating random numbers in Java
- Reading and Generating QR codes in Python using QRtools
- How to store a password in database?
- Wi-Fi Password of All Connected Networks in Windows/Linux
- Python | Random Password Generator using Tkinter
- Node JS | Password Hashing with Crypto module
- Resetting a root password in Linux without external media
- Reset a lost Linux administrative password and Explanation
- Java.util.LinkedList.poll(), pollFirst(), pollLast() with examples in Java
- Java.util.function.DoublePredicate interface in Java with Examples
- Java.util.function.BiPredicate interface in Java with Examples
- Java.util.function.LongPredicate interface in Java with Examples
- Java.util.Collections.disjoint() Method in java with Examples
- Java.util.function.IntPredicate interface in Java with Examples