What is the scope or life time of instance variables?



What is the scope or life time of instance variables?..

Answer / Saurabh Saran Diwakar

"Instance variables in Java have class scope and exist for the entire lifetime of an object. They are initialized when an object is created and persist until the object is destroyed. Instance variables can be accessed from any method within the same class, as well as from methods within subclasses if access privileges allow it."n

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Can you call a constructor within a constructor?

7 Answers  


Is age a discrete variable?

1 Answers  


What is super?

1 Answers  


Can we pass a primitive type by reference in java? How

1 Answers  


Can static methods access instance variables in java?

1 Answers  


How can final class be used?

5 Answers   Accenture, Wipro,


What is a pattern what is an anti pattern?

1 Answers  


What is meant by the value of a variable?

1 Answers  


What are the advantages of defining packages in java?

1 Answers  


Are variables stored in ram?

1 Answers  


List the interfaces which extends collection interface?

1 Answers  


How does a for loop work?

1 Answers  


Categories