gs gs111 Inheritance (Using Java) - Hierarchical Inheritance - Quiz No.1
gs gs111 OOP Object Oriented Programming Java Quiz
This quiz belongs to book/course code gs gs111 OOP Object Oriented Programming Java of gs organization. We have 178 quizzes available related to the book/course OOP Object Oriented Programming Java. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Inheritance (Using Java). NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
class A { public void functionA() { System.out.println("Class A"); } } class B extends A { public void functionB() { System.out.println("Class B"); } } class C extends A { public void functionC() { System.out.println("Class C"); } } public class Hierarchical1 { public static void main(String args[]) { B obj1 = new B(); C obj2 = new C(); obj1.functionA(); obj2.functionA(); } }
class B class B
class C class C
class A class A
class B class C
class A { public void X() { System.out.print("Welcome"); } } class B extends A { public void Y() { System.out.print(" to "); } } class C extends A { public void Z() { System.out.print("NVAEducation"); } } public class Display { public static void main(String[] args) { B obj1 = new B(); C obj2 = new C(); obj1.X(); obj1.Y(); obj2.Z(); } }
class A { protected void func() { System.out.println("Class A"); } } class B extends A { public void func() { System.out.println("Class B"); } } class C extends A { public void func() { System.out.println("Class C"); } } public class Display1 { public static void main(String[] args) { B obj1 = new B(); A obj2 = new C(); obj1.func(); obj2.func(); } }
Class B Class A
Class B Class C
Class C Class A
class A { A() { System.out.println("Class A"); } } class B extends A { B() { System.out.println("Class B"); } } class C extends A { C() { System.out.println("Class C"); } } public class MultipleObjects { public static void main(String[] args) { B obj1 = new B(); C obj2 = new C(); } }
Class A Class B Class A Class C
Class B Class C
Class A Class B Class C