Q: What is the value of the expression m <= n if m is 7 and n is 5 in Java?
B
Answer:
B
Explanation:
If m is 7 and n is 5, the result of the expression m <= n using the less-than-or-equal-to operator (<=) in Java would be false. The expression checks if the value on the left (m in this case) is less than or equal to the value on the right (n).
Here's an example:
public class LessThanOrEqualToOperatorExample {
public static void main(String[] args) {
// Example values
int m = 7;
int n = 5;
// Check if m is less than or equal to n
boolean result = m <= n;
// Print the result
System.out.println("Is m less than or equal to n? " + result);
}
}
In this case, the output will be:
Is m less than or equal to n? false
Related Topic:
Share Above MCQ