public class Singleton2
extends java.lang.Object
data
.TestSingleton2
Modifier and Type | Field and Description |
---|---|
private int |
data
An instance attribute - for illustrative purposes
|
static Singleton2 |
uniqueinstance
The reference to the one and only instance.
|
Modifier | Constructor and Description |
---|---|
private |
Singleton2()
The constructor is private so that it is controlled by the class.
Initially the data value is set to 0. |
Modifier and Type | Method and Description |
---|---|
int |
getData()
data getter method |
void |
setData(int d)
data setter method |
public static final Singleton2 uniqueinstance
private int data
private Singleton2()
data
value is set to 0.