ExamVeda
Login
Home
71
What will be the output of the following Java program?
class A 
{
    int i;
    void display() 
    {
        System.out.println(i);
    }
}    
class B extends A 
{
    int j;
    void display() 
    {
        System.out.println(j);
    }
}    
class inheritance_demo 
{
    public static void main(String args[])
    {
        B obj = new B();
        obj.i=1;
        obj.j=2;   
        obj.display();     
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
72
What will be the output of the following Java program?
class A 
{
    int i;
}    
class B extends A 
{
    int j;
    void display() 
    {
        super.i = j + 1;
        System.out.println(j + " " + i);
    }
}    
class inheritance 
{
    public static void main(String args[])
    {
        B obj = new B();
        obj.i=1;
        obj.j=2;   
        obj.display();     
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
73
Which of these is not abstract?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
74
Does Java support multiple level inheritance?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
75
What will be the output of the following Java code?
class A 
{
    public int i;
    private int j;
}    
class B extends A 
{
    void display() 
    {
        super.j = super.i + 1;
        System.out.println(super.i + " " + super.j);
    }
}    
class inheritance 
{
    public static void main(String args[])
    {
        B obj = new B();
        obj.i=1;
        obj.j=2;   
        obj.display();     
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
76
What will be the output of the following Java code?
class A 
{
    public int i;
    protected int j;
}    
class B extends A 
{
    int j;
    void display() 
    {
        super.j = 3;
        System.out.println(i + " " + j);
    }
}    
class Output 
{
    public static void main(String args[])
    {
        B obj = new B();
        obj.i=1;
        obj.j=2;   
        obj.display();     
    }
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
77
What will be the output of the following Java code?
class A 
{
     int i;
int j;
     A() 
     {
         i = 1;
         j = 2;
     }
}
class Output 
{
     public static void main(String args[])
     {
          A obj1 = new A();
    System.out.print(obj1.toString());
     }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
78
Which of this keyword must be used to inherit a class?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
79
Which of these class is superclass of every class in Java?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
80
Which of these keywords cannot be used for a class which has been declared final?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board