• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

use of final modifyer

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HiI have two questions

Can you tell me why the author uses final in this method




Thanks

What does notifyHitModelListener do?





The complete code is listed here

http://www.onjava.com/onjava/2004/07/07/examples/mvc-traditional.zip

The description text here

http://www.onjava.com/pub/a/onjava/2004/07/07/genericmvc.html
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
He uses final so that the reference cannot be inadvertantly changed such as:

addHitModelListener (final HitModelListener hitModelListener) {
hitModelListener = new HitModelListener(); //NO!!
}
 
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does notifyHitModelListener do?




Answer to Q2:
together these two methods loop through a collection of listeners and call hitModelChanged() on each of them
reply
    Bookmark Topic Watch Topic
  • New Topic