This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Constructer variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructer variables" Watch "Constructer variables" New topic
Author

Constructer variables

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
what is the scope of variables declared inside constructer...... and where does the constructers occupy memory whether in heap or stack....


Creativity is nothing but Breaking Rules
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14998
    
  27

Variables declared inside a constructor work exactly the same as local variables declared in a method. The scope is ofcourse the enclosing block (which might be the constructor itself). Variables are allocated on the stack, and objects are always allocated on the heap.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
thanks very much ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constructer variables
 
It's not a secret anymore!