Explore what CodeHS has to offer for districts, schools, and teachers.
Click on one of our programs below to get started coding in the sandbox!
View All
What will this code return given checkMethod(false, false)?
checkMethod(false, false)
public int checkMethod(boolean x, boolean y) { if(!x) { if(y) { return 0; } else { return -1; } } else { if(y) { return 1; } else { return 2; } } }
0
-1
1
2
This method call will error.