English

What is the output of the following program: double w = 12.5; w*= 2; System.out.println("w is" + w);

Advertisements

Question

What is the output of the following program:

double w = 12.5;
w*= 2;
System.out.println("w is" + w);
Very Short Answer
Advertisements

Solution

The statement w *= 2; multiplies the value of w by 2.

w = 12.5 × 2

w = 25.0

Output:

w is25.0
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 43. | Page 132
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×