File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes If at all you want to make the variable stay in the JVM for longer time, what do you do? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "If at all you want to make the variable stay in the JVM for longer time, what do you do?" Watch "If at all you want to make the variable stay in the JVM for longer time, what do you do?" New topic
Author

If at all you want to make the variable stay in the JVM for longer time, what do you do?

Tanu Gulati
Ranch Hand

Joined: Oct 06, 2008
Posts: 113

I got this in one of the Interview question, can any one answer me on this?

Question - If at all you want to make the variable stay in the JVM for longer time, what do you do?


thanks
Tanu Gulati
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064
    
  33

Declare it as a static variable- These would be GC'd only when the Class is unloaded.


Mohamed Sanaulla | My Blog
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

Declare it as a static.


Life is easy because we write the source code.....
Tanu Gulati
Ranch Hand

Joined: Oct 06, 2008
Posts: 113

thanks guys ...I appreciate your quick response
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: If at all you want to make the variable stay in the JVM for longer time, what do you do?
 
Similar Threads
Question about servlets and JVMs
Usage of Volatile keyword
garbage collection?
Probably it may be really silly question for others but not for me.
Daemon Thread