在下面的代码&&
中,if else 语句中给出了语法错误,我不确定如何解决它。任何人都可以提供解决方案吗?
//Importing scanner
import java.util.Scanner;
public class Credithistory {
public static void main(String[] args) {
//Stating scanner gets its input from console
Scanner scanner= new Scanner (System.in);
//declaring int and boolean
int age;
boolean goodCreditHistory;
System.out.println("Please enter your age... ");
age= scanner.nextInt();
System.out.println("Do you have a good credit history (true or flase)?");
goodCreditHistory= scanner.nextBoolean();
if (age>=18) && ( goodCreditHistory== true){ // <-------------- Error
System.out.println("You have got a credit card!");
} else
System.out.println ("Sorry you are not eligible for a credit card.");
}
}