Menu
Question Index
...

What will be the output of the following program?

public class DemoOnOverloading {
    int input = '\u0021';
    public static void main(String[] args)     {
        DemoOnOverloading object = new DemoOnOverloading();
        object.incrementor(object);
        System.out.print(object.input);
    }
    void incrementor(DemoOnOverloading inputObject) {
         byte a = 6;
         inputObject.input += ++input + ++a + ++inputObject.input;
    }
}


Output = 109
Output = 21
Output = 111
Compilation Error
Runtime Error

Doubts

Problems

Topic: Is Java Pass by Reference or Pass by Value

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App