The inequality operator (!=) in Java is used to check if two values are not equal. In this case, 8 != 5 is true because 8 is not equal to 5.
If m
is 8 and n
is 5, the expression m != n
using the inequality operator (!=
) in Java evaluates to true
. This is because 8
is not equal to 5
.
Here's a simple Java program to illustrate this:
public class InequalityOperatorExample {
public static void main(String[] args) {
// Example values
int m = 8;
int n = 5;
// Check if the values are not equal
if (m != n) {
System.out.println("The values are not equal.");
} else {
System.out.println("The values are equal.");
}
}
}
When you run this program, it will print "The values are not equal."