Single Choice
Not Set
QWhat will be printed after executing following program code?
class Base{
int value = 0;
Base(){
addValue();
}
void addValue(){
value += 10;
}
int getValue(){
return value;
}
}
class Derived extends Base{
Derived(){
addValue();
}
void addValue(){
value += 20;
}
}
public class Test{
public static void main(String[] args){
Base b = new Derived();
System.out.pr
ID: #2240
Overriding and Overloading in Java
1,148 views
Question Info
#2240Q ID
Not SetDifficulty
Overriding and Overloading in JavaTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
40
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic