Computer Science, asked by pbhowmik497, 1 month ago

Give the output of the following statement when executed if a=4and b=2 system.out.println("The sum="+(a+b))​

Answers

Answered by BrainlyProgrammer
4

Answer:

The sum=6

Explanation:

a+b is in bracket so it simply gets added and printed

Answered by PranathP
1

Given, a = 4 and b = 2

Execute: System.out.println("The sum="+(a+b));

Here, a+b = 4+2 = 6

Therefore,

Output: The sum=6

Explanation:

Here, System.out.println is used to print a statement. Whatever needs to printed needs to be written inside () brackets. If a specified sentence has to be printed then it is written inside "" double quotation marks, but if some calculation needs to be performed, or a variable needs to be printed then the name of the variable is simple written.

Here, the statement thats specified gets printed as:

The sum=

Now, the calculation performed, a+b is printed after evaluating it.

Therefore, we get the output as The sum=6.

Similar questions