alcuni test su synchronized e singleton

This commit is contained in:
2014-10-12 16:07:22 +02:00
parent dfa68cf46d
commit 63f94029df
7 changed files with 254 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
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;
}
}