Given:
2. public class Main { 3. public static void main(String[] args) { 4. String result = ""; 5. int x = 7, y = 8; 6. if(x == 3) { result += "1"; } 7. else if (x > 9) { result += "2"; } 8. else if (y < 9) { result += "3"; } 9. else if (x == 7) { result += "4"; } 10. else { result += "5"; } 11. System.out.println(result); 12. } //from w w w . j av a 2 s . c om 13. }
What is the result? (Choose all that apply.)
A is correct.
It's legal to declare several variables on a single line, and it's legal to have multiple else-if statements.
Once an else-if succeeds, the remaining else-if and else statements in the block are ignored.