| Author |
Why to Mark as Final when accessed from Inner Class
|
Ragupathirajan Venkatesan
Ranch Hand
Joined: Aug 18, 2010
Posts: 62
|
|
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
Joined: Jan 28, 2008
Posts: 5575
|
|
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
Joined: Aug 18, 2010
Posts: 62
|
|
Hi Seetharaman,
Thanks for your reply and advice.
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Ragupathirajan Venkatesan wrote:
Thanks for your reply
You are welcome
|
 |
 |
|
|
subject: Why to Mark as Final when accessed from Inner Class
|
|
|