Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Ch5 {
- private String usnm = "Dragon";
- private String pswd = "BallZ";
- boolean statement = false;
- public static boolean compare(String name, String pw){
- if (name.equals(usnm) && pw.equals(pswd)){
- statement = true;
- }
- return statement;
- }
- public static void main(String[]args) {
- String inputUsnm;
- String inputPswd;
- System.out.println("Type in the username followed by password to access the program");
- Scanner input = new Scanner(System.in);
- inputUsnm = input.nextLine();
- inputPswd = input.nextLine();
- compare(inputUsnm, inputPswd);
- System.out.println("Your login is " + statement + " real result " + compare(inputUsnm, inputPswd));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement