Question:

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

package com.vq.classes;

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

    private VQClassB(int x, int y) {
        this.x = x;
        this.y = y;
    }

    private int x;

    private int y;

    public static void main(String[]args) {
        VQClassB vqb = new VQClassB(20, 10);

        VQClassB.VQClassA vqa = new VQClassB(10, 10).new VQClassA(10);

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

Answers:


Keywords:

© 2017 QuizBucket.org