What would be the output of the following code snippet if variable a=10?if(a

🎲 Try a Random Question  |  Total Questions in Quiz: 20  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Java Basics Practice Test: Control Statements — practice the complete quiz, review flashcards, or try a random question.

In Java, control statements are used to control the flow of execution in a program. They are used to make decisions, to loop through blocks of code multiple times, and to jump to a different part of the code based on certain conditions.   There are three main types of control statements in Java: Decision-making statements: These statements allow you to make decisions about which block of code to execute based on a condition. The most common decision-making statements are the if, else if, and else statements. Looping statements: These statements allow you to execute a block of code... Show more

What would be the output of the following code snippet if variable a=10?<br>if(a<=0)<br>{<br> if(a==0)<br> {<br> System.out.println("1 ");<br> }<br> else <br> { <br> System.out.println("2 ");<br> }<br>}<br>System.out.println("3 ");