• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

meaning of @override

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the meaning of @override in Java 1.5.
Thanks.
 
Sheriff
Posts: 9693
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Siddhart @Override is an annotation that describes that the method on which it is put, overrides a method from a super-type. If the method doesn't override any method from a super-type, then there will be a compilation error.

Annotations are not a part of SCJP...
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a useful discussion on @Override:
http://stackoverflow.com/questions/94361/when-do-you-use-javas-override-annotation-and-why
 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can we get some detailed explanation on it?
 
author
Posts: 9035
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ankit is correct !!!

Annotations are NOT on the exam. So, if you want to discuss annotations, and it is a wonderful topic!, then perhaps the intermediate forum would be a great place to do so.

hth,

Bert
 
Marshal
Posts: 75866
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you have already had a good explanation on the stackoverflow website which Satya Maheshwari quoted.

What a name for a website-stackoverflow!

There is an explanation in the Java Tutorials which is worth reading, and the answers on stackoverflow were useful.

Remember: the commonest reason for not correctly overriding a method is a simple mistake: find the MouseAdapter class and try a new class which has the MouseClicked method in. If you are not aware of the mistake you can spend hours and hours failing to work out what has gone wrong (I have seen that sort of error several times here on the Ranch).

I was a bit surprised that people on stackoverflow said you get errors because the superclass interface has been changed. That sounds like very bad practice: once a class has been deployed you mustn't alter any parts of its public interface, except maybe by adding new methods.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic