Single Choice
Not Set
QWhat will be the output?
class A{
int i = 10;
public void printValue(){
System.out.print("Value-A");
}
}
class B extends A{
int i = 12;
public void printValue(){
System.out.print("Value-B");
}
}
public class Test{
public static void main(String args[]){
A a = new B();
a.printValue();
System.out.print(a.i);
}
}
ID: #2262
Inheritance in Java MCQ
1,507 views
Question Info
#2262Q ID
Not SetDifficulty
Inheritance in Java MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
Value-B 10
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic