PasswordAuthentication GetPassword() Example
Returns the user password.
PasswordAuthenticationclass GetPassword() method example. This example shows you how to use GetPassword() method.This method Returns the user password.
Here is the code:-
/*
* @Program that Returns the user password.
* GetPassword.java
* Author:-RoseIndia Team
* Date:-28-Jun-2008
*/
import java.net.*;
public class GetPassword {
public static void main(String[] args) throws Exception {
String userName = "Girish";
char[] password = {'R', 'o', 's', 'e', 'i', 'n', 'd','i','a'};
PasswordAuthentication authentication = new
PasswordAuthentication(userName, password);
System.out.print("The user password is: ");
//Returns the user password.
System.out.println(authentication.getPassword());
}
} |
Output of the program:-
| The user password is: Roseindia |
|