Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mattroseb8wk2;
- import java.util.Scanner;
- // what if 8A is modified to also accept usernames in nested if form
- // with conditions from file 7E
- public class Day08B {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String username;
- String passWord;
- String correctUname = "admin";
- String correctPass = "123450";
- System.out.print("Enter username : ");
- username = sc.nextLine();
- System.out.print("Enter password : ");
- passWord = sc.nextLine();
- if (username.equals(correctUname)) { // cond 1
- if (true) { // cond 2
- System.out.println("Authentication complete");
- }
- } else {
- System.out.println("Please try again");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment