Menu
Topics Index
...
`

Hikes and Hikes


If you need explanation Read this topic

If you need Answer Take test on this topic

Hikes and Hikes
What will be the output of the following program?
public class Hikes {

    public static void main(String[] args) {
        int dailywage = 4;
        int number_of_days = 5;
        int salary = number_of_days++ * --dailywage * dailywage++ * number_of_days--;
        salary =- dailywage;
        System.out.println(dailywage + " " + number_of_days + " " + salary);
    }
}

A. 4 5 316
B. 4 5 176
C. 4 5 266
D. Some other output or compilation error
Topic: Increment And Decrement Operators In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans: C first salary=270(5*3*3*6) and then sal=266

Posted by Indrasena Reddy    2014-05-13 04:23:23


ans : d
salary = daily..... ; after this line
daily wage= 4
no of day=5
so in salary =- daily wage ; salary got -4;
so out put is..
4 5 - 4

Posted by Sree Priya    2014-05-13 04:46:04


Congratulations Sree Priya. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-05-14 04:04:04


© meritcampus 2019

All Rights Reserved.

Open In App