Login Check with &&
Easyjava
Access is granted only if both the username and the password match the expected values.
Input: four lines — expected username, expected password, entered username, entered password.
Output: one line — Access granted or Access denied.
Example 1
Input
admin secret admin secret
Output
Access granted
- each value is one line, 1..30 characters, no spaces
Hint 1
Compare strings with .equals, not ==.
Hint 2
expUser.equals(gotUser) && expPass.equals(gotPass)
Both the username check and the password check must be true, so combine the two .equals results with &&. If either fails, access is denied.