Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Final Arguments

 
Ranch Hand
Posts: 203
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,

WHILE GOING THROUGH FINAL ARGUEMENTS...
public Record getRecord(int fileNumber, final int recordNumber) {}

...
the variable recNumber is declared as final, which of course means it can't be modified within the method..explain it in detail...!!
 
author
Posts: 23924
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Saral Saxena wrote:Hi folks,

WHILE GOING THROUGH FINAL ARGUEMENTS...
public Record getRecord(int fileNumber, final int recordNumber) {}

...
the variable recNumber is declared as final, which of course means it can't be modified within the method..explain it in detail...!!



What is there to explain? Final means exactly what you said it means.

Henry
 
Marshal
Posts: 76081
362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read this. Please go back and edit your post in line with that link.

It means it can’t be reassigned within the method. If they have gone to the trouble of marking the second parameter (not argument) final, why haven’t they marked them both final? I cannot explain any more with the information I have been given.
If you think it means you can’t alter the original value of the argument (not parameter), you have not understood pass-by-value.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Saral Saxena wrote:
explain it in detail...!!



Since English is not your native language, you may not be aware of it, but that sounds bossy and rude. Simply adding the word "please", or phrasing it as a question, such as, "Could someone explain it?" would make it more polite.

Also, you need to be clear about what you don't understand. Don't make the mistake of thinking these forums are a substitute for you spending time--a LOT of time--researching, studying, reading, thinking, getting frustrated but continuing to work on it, writing code, etc.
reply
    Bookmark Topic Watch Topic
  • New Topic