Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 31st, 2004, 07:41 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default who destroy static variables(no instance of class)

Hi,

I have created a class that contains one static variable and one static method.
the method fills the variable and this method is called without classinstance(as it is static).

My question is: what happens to my variable after it is used? the garbage collector destroys it?

thank you,
Michael.
Reply With Quote
  #2 (permalink)  
Old March 31st, 2004, 08:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The static variable will live as long as the class is loaded in the JVM. When there are no more instances of the class being ran in the JVM the class will be unloaded and the static variable will be eligable for garbage collection.

Cheers

Martyn
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using logging class as a static class punitw General .NET 0 August 14th, 2008 03:03 AM
Problem with static variables behaviour shujamughal ASP.NET 2.0 Professional 4 July 21st, 2007 01:56 AM
Declaring static variables in ASP lakshmi_annayappa ASP.NET 1.0 and 1.1 Basics 1 May 24th, 2007 06:49 AM
static field with class instance prakash.suthar Java Basics 2 July 3rd, 2006 01:41 AM
how to destroy static variable? janedong VS.NET 2002/2003 2 November 30th, 2004 10:26 PM



All times are GMT -4. The time now is 09:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.