Computer Applications
Determine the output of the following program.
public class PredictOutput2
{
public static void main(String args[])
{
int a = 6, b = 2, c = 3;
System.out.println("Output 1: " + (a == b * c));
System.out.println("Output 2: " + (a == (b * c)));
}
}
Java
Java Operators
24 Likes
Answer
Output
Output 1: true
Output 2: true
Explanation
b * c results in 6 which is equal to the value of a so true is printed in both the cases.
Answered By
13 Likes
Related Questions
What is the difference between the following two statements in terms of execution? Explain the results.
x -= 5;
x =- 5;Determine the output of the following program.
public class PredictOutput3 { public static void main(String args[]) { int a = 2, b = 2, c = 2; System.out.println("Output 1: " + (a + 2 < b * c)); System.out.println("Output 2: " + (a + 2 < (b * c))); } }
Determine the output of the following program.
public class PredictOutput1 { public static void main(String args[]) { int a = 4, b = 2, c = 3; System.out.println("Output 1: " + (a = b * c)); System.out.println("Output 2: " + (a = (b * c))); } }
What is concatenation? On which data type is concatenation performed?