gs gs111 Inheritance (Using Java) - Single Level Inheritance - Quiz No.2
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 5 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 Base { String s = "NVAEducation"; } class Derived extends Base { Integer y = new Integer(47); void display() { System.out.println(s.getClass().getSuperclass()); System.out.println(y.getClass().getSuperclass()); } } public class ClassName1 { public static void main(String[] args) { Derived a = new Derived(); a.display(); } }
class java.lang.Object class java.lang.Number
class java.lang.String class java.lang.Integer
class java.io.Object class java.io.Number
class java.util.Object class java.util.Number
class Base { void print() { System.out.println("Base"); } } class Derived extends Base { void print() { super.print(); System.out.println("Derived"); } } public class Super { public static void main(String[] args) { Derived a = new Derived(); a.print(); } }
Derived Base
Base Derived
class Base { int a = 37; } class Derived extends Base { int b = 45; void calculate() { System.out.println(a*b); } } public class Multiply { public static void main(String[] args) { Derived a = new Derived(); a.calculate(); } }
class Base { String s = "San"; } class Derived extends Base { String s = "foundry"; void print() { System.out.println(super.s+s); } } public class NVAEducation { public static void main(String[] args) { Derived a = new Derived(); a.print(); } }