πŸ“’ Too many exams? Don’t know which one suits you best? Book Your Free Expert πŸ‘‰ call Now!

  • google app store apple app store
  • βœ–

      Question

      Which keyword is used in Java to indicate that a method

      in a subclass is intended to override a method in its superclass?
      A new Correct Answer Incorrect Answer
      B virtual Correct Answer Incorrect Answer
      C override (C#) / @Override (Java annotation) Correct Answer Incorrect Answer
      D super Correct Answer Incorrect Answer
      E this Correct Answer Incorrect Answer

      Solution

      In Java, the @Override annotation is used to explicitly indicate that a method is intended to override a method in a superclass. While not strictly required for overriding, it helps the compiler detect errors (e.g., if the method signature doesn't actually match a superclass method). In C#, the override keyword is used.

      Practice Next
      ask-question