Menu
Question Index
...

What lines in the following program has compilation errors?

public class CatRatMatBatHat {
    public static void main(String[] args) {
        Cat cat = new Cat(); /* LINE A */
        Rat rat = new Rat(); /* LINE B */
        Hat hat = new Hat(); /* LINE C */
        Mat mat = new Mat(); /* LINE D */
        Bat bat = new Bat(); /* LINE E */
        cat = mat; /* LINE F */
        rat = mat; /* LINE G */
        bat = rat; /* LINE H */
        hat = bat; /* LINE I */
        mat = hat; /* LINE J */
        bat = mat; /* LINE K */
    }
}

interface Cat {}
class Rat {}
interface Hat {}
class Mat extends Bat implements Cat {}
class Bat extends Rat implements Cat, Hat {}


A, B, C, D
B, D, E, F, G
A, C, D, H, I, J
A, C, H, J
A, C, F, H, J

Doubts

Problems

Topic: Creating Interface In Java With Example Program

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App