gs gs111 Polymorphism (Using Java) - Method Overriding - 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 Polymorphism (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 { public void show() { System.out.println("Base"); } } class Derived extends Base { public void show() { System.out.println("Derived"); } } public class Overriding { public static void main(String[] args) { Base i = new Derived(); i.show(); } }
class B { protected final void Display() { System.out.println("B"); } } public class C extends B { protected final void Display() { System.out.println("C"); } public static void main(String[] args) { B obj = new B(); obj.Display(); } }
class Derived1 { public int print() { System.out.println("Derived class"); return 0; } } public class Base1 extends Derived1 { public void print() { System.out.println("Base class"); } public static void main(String[] args) { Derived1 obj = new Derived1(); obj.print(); } }
class Derived { public void print() { System.out.println("Derived class"); } } public class Over extends Derived { protected void print() { System.out.println("Base class"); } public static void main(String[] args) { Derived obj = new Over(); obj.print(); } }
class Derived { protected void print() { System.out.println("Derived class"); } } public class Override1 extends Derived { public void print() { System.out.println("Base class"); } public static void main(String[] args) { Derived obj = new Override1(); obj.print(); } }
class Derived { public void display() { System.out.print("Derived class"); } } public class OverRiding extends Derived { public void display() { System.out.print("Base class"); super.display(); } public static void main(String[] args) { Derived obj = new OverRiding(); obj.display(); } }
import java.io.IOException; class Derived { public void print() throws IOException { System.out.println("IOE"); } } public class Exceptions extends Derived { public void print() throws Exception { System.out.println("Exception"); } public static void main(String[] args) throws IOException { Derived obj = new Exceptions(); obj.print(); } }