40 lines
505 B
Java
40 lines
505 B
Java
package threads_test;
|
|
|
|
/**
|
|
* Created by Giovanni on 12/10/2014.
|
|
*/
|
|
public class test_2_singleton {
|
|
|
|
private test_2_singleton(){
|
|
|
|
a="initialized";
|
|
|
|
}
|
|
|
|
private String a;
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
private static class inner_test_2_singleton {
|
|
|
|
|
|
private static final test_2_singleton x = new test_2_singleton() ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static test_2_singleton get_instance(){
|
|
|
|
return inner_test_2_singleton.x;
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|