• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

@override in j2se 5

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

just a quick question: i am using jdk 1.5.(something) with intelliJ 4.5, and when override a method i get a intensions tip to change to @Override. i.e.:

public void run(){} -> @Override public void run(){}

could someone tell me more about this change in coding in 1.5? (or is this intellij specific?)

thanks
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is one example of something called "annotations", new in Java 1.5. The @Overrides tells the compiler that you intended to override something; if the signatures don't match, you get a compiler error. This bullet-proofs your subclass against changes to the superclass -- at the expense of making your code 1.5-dependent, of course.

To be honest, I'm not aware of any especially good documentation on these; you can try your luck with any of the latest crop of books about "Tiger", the Java 1.5 codename.
 
Tian Zhang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
though i read through the "what's new" in the api, but obivously left a vital section out

thanks.
 
Ranch Hand
Posts: 39
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic