English

What is the output of the following: int a = 0; int b = 10; a =-b; System.out.println("a:” + a + “b:" +b);

Advertisements

Question

What is the output of the following:

int a = 0;
int b = 10;
a =-b;
System.out.println("a:” + a + “b:" +b);
Very Short Answer
Advertisements

Solution

The given code produces a compilation error due to incorrect quotation marks in the System.out.println() statement.

Output: a:-10b:10

shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Variables and Expressions - EXERCISE [Page 132]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 6 Variables and Expressions
EXERCISE | Q 42. | Page 132
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×