explain the conditions in java? write a program with the help of nesting of IF.... ELSE
Answers
Answered by
20
Answer:
Java, like all other programming languages, is equipped with specific statements that allow us to check a condition and execute certain parts of code depending on whether the condition is true or false. Such statements are called conditional, and are a form of composite statement.
SYNTAX
if (expression) {
// codes
}
else {
// some other code
}
EXAMPLE
class IfElse {
public static void main(String[] args) {
int number = 10;
if (number > 0) {
System.out.println("Number is positive.");
}
else {
System.out.println("Number is not positive.");
}
System.out.println("This statement is always executed.");
}
}
Explanation:
HOPE IT HELPS YOU,
THX
Similar questions
Computer Science,
6 months ago
Math,
6 months ago
Physics,
11 months ago
Science,
11 months ago
Social Sciences,
1 year ago
Accountancy,
1 year ago