A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Take Control of Upgrading to Yosemite
Take Control of Automating Your Mac
this week in the
Memory leaks and static variables
Joined: May 06, 2008
Mar 18, 2010 09:45:39
I have been reading up on coding practices that could cause memory leaks and one of them is using static variables or classes,
Since they will remain for lifetime of the application.
Question that comes to my mind is that:- usually when we define a constants file its mostly a
and all the strings are defined as :
public static final
Now another way of defining the same string as a constant would be to have an
and within the interface you define
Would using an interface to define constants rather than have a class with static definitions make any difference in concerns with memory saving?
Appreciate all your inputs
Joined: Aug 26, 2008
Mar 18, 2010 09:51:34
Whenever you define a variable in interface by default it is public static and final. So I don't see any difference in both the cases.
subject: Memory leaks and static variables
How to define constants for several classes?
public static final String
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014