5. User Password Management

Source: Internet
Author: User
Tags administrator password

 Public class Administrator {    String name;         // name    String password;    // Password         // Displaying information methods     Public void Show () {        System.out.println ("Name:" + name + ", Password:" + password);}    }
ImportJava.util.Scanner; Public classChangePassword {/*** Change Administrator password*/     Public Static voidMain (string[] args) {Scanner input=NewScanner (system.in); Administrator Admin=NewAdministrator ();//Create an Administrator objectAdmin.name = "Admin1";//Assigning a value to the Name propertyAdmin.password = "111111";//Assigning a value to the Password property//Enter the old user name and passwordSystem.out.print ("Please enter user name:"); String Nameinput=Input.next (); System.out.print ("Please enter your password:"); String pwd=Input.next (); //determine whether the user name and password entered by the user are correct        if(Admin.name.equals (Nameinput) &&admin.password.equals (PWD)) {System.out.print ("\ n Please enter a new password:"); Admin.password= Input.next ();//Change PasswordSYSTEM.OUT.PRINTLN ("Change password successfully, your new password is:" +Admin.password); }Else{System.out.print ("User name and password do not match!" You do not have permission to update administrator information. "); }    }}

5. User Password Management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.