Question:

ode below has class VQClassB which inherits another class VQClassA, study following code carefully and choose correct option about output of program.

package com.vq.classes;

class VQClassA {
    public VQClassA(int x) {
        this.x = x;
    } protected int x;
}

public class VQClassB extends VQClassA {
    public VQClassB(int x, int x2, int y) {
        super(x);
        x = x2;
        this.y = y;
    } private VQClassB(int x, int y) {
        super(x);
        this.x = x;
        this.y = y;
    }

    private int x;

    private int y;

    public static void main(String[]args) {
        VQClassA vqa = new VQClassA(10);

        VQClassB vqb = new VQClassB(20, 10);

        vqa = vqb;
        System.out.println(vqa.x + " " + vqb.y);
    }
}

Answers:


Keywords:

© 2017 QuizBucket.org