a) public member b) private member c) protected member d) static member ...
View QuestionWhich of this keyword must be used to inherit a class?
a) super b) this c) extent d) extends Answer: d Explanation: ...
View Question
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();
}
}
What will be the output of the following Java code? class A
View Question
What will be the output of the following Java code?
class A
{
int i;
void display()
{
System.out.println(i);
}
}
class B extends A
{
int j;
void display()
{
System.out.println(j);
}
}
class method_overriding
{
public static void main(String args[])
{
B obj = new B();
obj.i=1;
obj.j=2;
obj.display();
}
}
}
What will be the output of the following Java code? class A ...
View Question
What will be the output of the following Java code?
class A
{
public int i;
public int j;
A()
{
i = 1;
j = 2;
}
}
class B extends A
{
int a;
B()
{
super();
}
}
class super_use
{
public static void main(String args[])
{
B obj = new B();
System.out.println(obj.i + ” ” + obj.j)
}
}
}
What will be the output of the following Java code? class A ...
View Question
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();
}
}
What will be the output of the following Java code? class A ...
View QuestionWhich of these packages contains abstract keyword?
a) java.lang b) java.util c) java.io d) java.system Answer: a
View QuestionWhich of these is not a correct statement?
a) Every class containing abstract method must be declared abstract b) Abstract class defines only the structure of ...
View QuestionIf a class inheriting an abstract class does not define all of its function then it will be known as?
a) Abstract b) A simple class c) Static class d) None of the mentioned Answer: a Explanation: Any subclass ...
View QuestionWhich of these is not abstract?
a) Thread b) AbstractList c) List d) None of the Mentioned Answer: a Explanation: Thread is not an abstract ...
View Question