How to code an if else statement in java?

If else statement in java:      

    As in other programming languages, the Java language also supports the flow control architecture. With this structure, the program will check one or more conditions, and if these conditions are true, then the command or commands corresponding to this true condition will be executed, otherwise the commands corresponding to the condition The false statement will be executed.

Conditional operators (? :) in Java

      In addition to the above commands, the Java language also has a type of conditional operator that allows you to quickly test conditions and perform a value assignment for a variable very quickly.This operator consists of three operands and is used to evaluate relational expressions. The goal of the operator is to decide what value will be assigned to the variable. This operator is written as follows:
if-else-statement-in-java

Another example:
if-else-statement-in-java-1

if-else-statement-in-java
To find out more about instance variables in java:

Comments