could you check these codes? I can't find the problem. "If" has no action! It should check username and password and age. After that if all of details are true will answer true unless will answer false.But "If" don't answer.
import java.util.Scanner;
public class Class2 {
public static void main(String[] args) {
int age;
String password = "big.110@go";
String username = "big";
Scanner keyboardInput = new Scanner(System.in);
System.out.print("Please enter your Usename: ");
username = keyboardInput.next();
System.out.print("Please enter your age: ");
age = keyboardInput.nextInt();
System.out.print("Please enter your password: ");
password = keyboardInput.next();
if(keyboardInput.next().equals(username)
&& keyboardInput.nextInt() >= 18
&& keyboardInput.equals(password)) {
System.out.print("Welcome");
} else {
System.out.print("Something is wrong!\n Try again");
}
}
}
You made a lot of mistake in your code.