Aliensbrain
  • Home
  • Topics
  • Quizzes
  • Notebooks
  • Community
  • Sign in
  • programming languages Online Quiz - 182
  • package inheritance; public class TestInheritance7{ prot...

package inheritance; public class TestInheritance7{ protected int p = 100; } package inheritance1; import inheritance.TestInheritance7; public class TestInheritance_7 extends TestInheritance7{ void printP() { TestInheritance7 T7 = new TestInheritance7(); System.out.println("p = "+T7.p); } public static void main(String[] args) { TestInheritance_7 T_7 = new TestInheritance_7(); T_7.printP(); } }

technology programming languages
  1. p = 100

  2. Compiler error

  3. p = 0

  4. Exception


Show answer
Correct Option: B

Find more quizzes:

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