Menu
Question Index
...

What is the output of the following program?

public class Ganguly {
    public static void main(String[] args) {
        Yuvraj uv = new Yuvraj();
        System.out.println(uv.getVaue(uv));
    }
}
class Dhoni {
    byte getVaue(Object obj) {
        if (obj != null)
            return (byte) 130;
        else
            return -1;
    }
}
class Yuvraj extends Dhoni {
    byte getVaue(Object obj) {
        if (obj != null)
            return (byte) 129;
        else
            return -1;
    }
}


129
-126
-127
130
Compilation or Runtime Error

Doubts

Problems

Topic: Advanced Java Programming Concepts

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App