逻辑出现了问题!
import java.util.*;class Test21{
public static void main(String args[]){
Scanner i = new Scanner(System.in);
System.out.println("So you want a holiday in the Caribbean ...");
System.out.print("Non-stop flights is important(true/false)");
Boolean t = i.nextBoolean();
System.out.print("Beautiful beaches is important(true/false)");
Boolean k = i.nextBoolean();
System.out.print("Shopping is important(true/false)");
Boolean l = i.nextBoolean();
if ((t=true)&&k= true)&&(l=true))
System.out.println("Barbados");
if ((t=true)&&(k=true)&&(false))
System.out.println("Barbados or St.Lucia");
if ((t=true)&&(k=false)&&(l=true))
System.out.println("Barbados or St.Lucia");
if((t=true)&&(k=false)&&(l=false))
System.out.println("Barbados or St.Lucia or Trinidad or Tobago");
if((t=false)&&(k=false)&&(l=true))
System.out.println("Barbados or Grenada or St.Lucia");
if((t=false)&&(k=true)&&(l=false))
System.out.println("Barbados or Grenada or Tobago");
if((t=false)&&(k=true)&&(l=true))
System.out.println("Barbados or Grenada");
if((t=false)&&(k=false)&&(l=false))
System.out.println("you can go anywhere");
}
}
我不管输入什么都打印barbados!