Aliensbrain
  • Home
  • Topics
  • Quizzes
  • Notebooks
  • Community
  • Sign in
  • programming languages Online Quiz - 318
  • What will this program print out ? class Base{ int ...

What will this program print out ? 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()); } }

technology programming languages
  1. 10

  2. 20

  3. 30

  4. 40


Show answer
Correct Option: D

Find more quizzes:

© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy