V

Vikash Gupta • 33.56K Points
Instructor I

Q. What is method overriding in Java?

  • (A) Redefining a superclass method in a subclass
  • (B) Defining a new method with the same name in a subclass
  • (C) Making a method private in a subclass
  • (D) Hiding methods in a superclass
  • Correct Answer - Option(A)
  • Views: 17
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.

Related MCQs on JAVA

Q. how many bits are in a single IP address?

Q. How to convert a String to a Date object?

Q. What is it called where object has its own lifecycle and child object cannot belong to another parent object?

Q. Which of the following statements is legal in Java? (i) mysRef = (Mystery) mySecret; (ii) mysRef = (Mystery) secRef;

Q. What will be the result after the class Test execution? class A{ public void doA(){ B b = new B(); b.dobB(); System.out.print("doA"); } } class B{ public void dobB(){ C c = new C(); c.doC(); System.out.print("doB"); } } class C{ public void doC(){ if(true) throw new NullPointerException(); System.out.print("doC"); } } public class Test{ public static void main(String args[]){ try{ A a = new A(); a.doA(); }catch(Exception ex){ System.out.print("error"); } } }

Q. What will be the output of the following Java program? class Output { public static void main(String args[]) { Double i = new Double(257.5); Double x = i.MIN_VALUE; System.out.print(x); } }

Q. Which of the following is not a marker interface?

Q. What will be the output of the following Java program? class exception_handling { public static void main(String args[]) { try { int a[] = {1, 2,3 , 4, 5}; for (int i = 0; i < 5; ++i) System.out.print(a[i]); int x = 1/0; } catch(ArrayIndexOutOfBoundsException e) { System.out.print("A"); } catch(ArithmeticException e) { System.out.print("B"); } } }

Q. What is the output of the following code snippet?

Q. What is the output of this program?

Learn All JAVA MCQs


Question analytics