Computer Science, asked by bhupeshsharma71, 11 months ago

explain the conditions in java? write a program with the help of nesting of IF.... ELSE​

Answers

Answered by ArunBhattacharya
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