java or and operator code example
Example 1: java or
int num = 9;
if (num == 1 || num == 2) {
System.out.println("Nope");
}
if (num == 1 || num == 9) {
System.out.println("Yep");
}
Example 2: Operators in java
public class ArithmeticOperatorDemo
{
public static void main(String[] args)
{
int i = 25;
int j = 5;
System.out.println(i + j);
System.out.println(i - j);
System.out.println(i * j);
System.out.println(i / j);
System.out.println(i % j);
}
}
Example 3: Operators in java
public class JavaUnaryOperator
{
public static void main(String[] args)
{
int a = 23;
System.out.println("Java post-increment = " + a++);
System.out.println("Java pre-increment = " + ++a);
}
}