All i want is to return true if x and y are both "true".
I want to use the switch/case method, instead of a simple if/else.
But i can't get the method to accept my return result.
Do you guys have an idea?
public class test2 {
public static boolean f(boolean x, boolean y){
switch(x + "-" + y){
case "true-false":
return false; //i also tried "return x" or "return y"
case "false-true":
return false;
case "true-true":
return true;
case "false-false":
return false;
}
}
public static void main(String[]args){
f(false,true);
}
}