PasswordAuthentication GetUserName() Example

Returns the user name.


PasswordAuthenticationclass GetUserName() method example. This example shows you how to use GetUserName() method.This method Returns the user name.

Here is the code:-
/* 
 * @Program that Returns the user name.
 * GetUserName.java 
 * Author:-RoseIndia Team
 * Date:-28-Jun-2008
 */

import java.net.*;

public class GetUserName {

    public static void main(String[] argsthrows 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 name is: ");
        //Returns the user name.
        System.out.println(authentication.getUserName());
    }
}

Output of the program:-
 The user name is: Girish

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US