Menu
Question Index
...

public class Rough1 {
    public static void main(String[] args) {
        byte b = getStatusValue(255);
        System.out.println(b);
        b = Rough2.getStatusValue(122);
        System.out.println(b);
    }
    static byte getStatusValue(Object obj) {
        if (obj != null)
            return 127;
        else
            return -1;
    }
}
class Rough2 extends Rough1 {
    static byte getStatusValue(Object obj) {
        if (obj != null)
            System.out.println(obj);
        else
            return -1;
        return (byte) 255;
    }
}


127
122
-1
-1
122
-1
Compilation Error
Runtime Error

Doubts

Problems

Topic: Creating Static Methods In Java Using Static Keyword

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App