| Author |
Declaring variables in constructor?
|
Anto Telvin
Ranch Hand
Joined: Aug 12, 2008
Posts: 113
|
|
hi all If we are declaring/initializing a variable in constructor what type of variable is that local or class ? and where it is going to store in heap or stack thanks in advance
|
Anto Telvin Mathew<br />Many of the life failures are people who did not realize how close they were to success when they give up. EDISON
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
Well, if you are declaring, obviously, it is a local variable. If you are initializing, then it depends on how the variable was declared. Whether a variable is on the heap or stack depends on the type of variable. Beginning with Java 6, this is further complicated with escape analysis. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Anto Telvin
Ranch Hand
Joined: Aug 12, 2008
Posts: 113
|
|
|
thanks
|
 |
 |
|
|
subject: Declaring variables in constructor?
|
|
|