varibles of class type

A

asit

when we create an object of class type, memory is allocated in the
heap dynamically and a reference is passed to the class variable.

1>where is that variable created ??What is the scope of that
variable ???

2>As java does not have global scope, the will be no global variable.
So data memory in class programs remains unused. Is that so ???
 
J

John B. Matthews

asit said:
when we create an object of class type, memory is allocated in the
heap dynamically and a reference is passed to the class variable.

1> [W]here is that variable created? What is the scope of that
variable?

2> As java does not have global scope, the will be no global var-
iable. So data memory in class programs remains unused. Is that so?

You can read more about (1a) Run-time Evaluation of Class Instance
Creation Expressions, (1b) Scope of Local Variable Declarations, and (2)
Finalization of Class Instances here:

<http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top