How do you use the @Override annotation?

John Zukowski

Use this annotation to tell the compiler that the method is supposed to be overriding a method in the superclass. If by chance it doesn't, the compiler tells you. This allows you to catch typos like wrong case or incorrect return types/parameters.

public class Over {
  public void overrideMe() {
class SubOver extends Over {
  public void overrideme() {
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact