Method overriding and TypeCasting2966 - Java Quiz Question


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;
    }
}


A
127
122
-1
B
-1
122
-1
C
Compilation Error
D
Runtime Error