Java Programming Language MCQ Inheritance in Java MCQ
⚠ Report ✓ Question Verified Copy Link
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.println(b.getValue()); } }
Learn More MCQ Questions from Java Programming Language MCQ Inheritance in Java MCQ