This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why to Mark as Final when accessed from Inner Class  RSS feed

 
Ragupathirajan Venkatesan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I have method level local variable and i am using inside the inner class with in that method. System asking me to declare it has final variable. Please advise the reason behind that. example below.
public HashMap getValues(){
HashMap csvMap=null;
return (Forum) jdbcTemplate.queryForObject(query, new Object[] { Integer.valueOf(forumId) },
new RowMapper() {
public Object mapRow(ResultSet resultSet, int rowNum) throws SQLException {
while(resultSet.next){
csvMap.put(resultSet.getString(1),resultSet.getString(2));
}
}
});
}
csvMap is the local variable I am using.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, please apply code tag when you post code and people can read your post easily. so that you can get more response for your question.

Coming to your question, check out this thread
 
Ragupathirajan Venkatesan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Seetharaman,

Thanks for your reply and advice.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ragupathirajan Venkatesan wrote:
Thanks for your reply


You are welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!