in java determine the output of the following program:
public class Test
{
public static void main(string[] args)
{
int a = 1, b = 2;
System.out.println("Output1: " + a + b);
System.out.println("Output2: " + (a + b));
}
}
Answers
Answered by
4
Answer:
output 1 : 1
2
output 2: 3
Explanation:
because in statement 1 there is + sign which print a value along with b whereas in statement 2 a+b is inside bracket which gives it's total additional value
Similar questions
Science,
4 months ago
CBSE BOARD XII,
4 months ago
Economy,
4 months ago
Social Sciences,
8 months ago
Art,
8 months ago
Economy,
1 year ago