Results 1 to 2 of 2
- 12-03-2010, 06:10 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 18
- Rep Power
- 0
use of private in getter and setter
1.use of private variable in getter and setter method??
2. how to implement singleton class in another class??
like
public class Singleton {
// class is automatically instantiated when the
// class is loaded
private static Singleton instance = new Singleton()
// constructor is made inaccessible by declaring
// it private
private Singleton() { ... }
// Access to the single instance of the class is
// provided by a static accessor method
public static Singleton getInstance() {
// returns a reference of the private instance
return instance;
}
// rest of the class implementation
}
i have one more class...how to use singleton class inside this???
class B
{
}
- 12-03-2010, 07:17 PM #2
Member
- Join Date
- Dec 2010
- Posts
- 10
- Rep Power
- 0
Similar Threads
-
A private static ArrayList hold an object and static getter ArrayList
By Louis in forum New To JavaReplies: 2Last Post: 11-16-2010, 05:51 PM -
Ideas about private to private IP networking over the Internet
By mr_anderson in forum Advanced JavaReplies: 7Last Post: 06-28-2010, 07:52 AM -
private static setter method problem
By kyussy in forum New To JavaReplies: 7Last Post: 01-27-2010, 04:02 PM -
Constructors, Setter & Getter << need some explaining
By A.M.S in forum New To JavaReplies: 4Last Post: 01-01-2009, 12:03 PM -
problem in getter method
By freddieMaize in forum Advanced JavaReplies: 5Last Post: 05-26-2008, 07:02 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks