File: TestFinalStatic.java

package info (click to toggle)
tya 1.6-1
  • links: PTS
  • area: contrib
  • in suites: potato
  • size: 628 kB
  • ctags: 843
  • sloc: ansic: 7,028; asm: 618; java: 497; makefile: 88; sh: 18
file content (29 lines) | stat: -rw-r--r-- 746 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class TestFinalStatic
{
	public static final String str;
	public static final Object obj = new Object();
	
	static {
		 str = "Following should be true";
	}
	
	
	public static void main( String argv[] )
	{
		Object o = new Object();
		String s;
		long startTime = System.currentTimeMillis();
		int sint;
		for( sint =0; sint < 5000000; sint++ )
		{
			o = obj;s = str;o = obj;s = str;o = obj;s = str;
			o = obj;s = str;o = obj;s = str;o = obj;s = str;
			o = obj;s = str;o = obj;s = str;o = obj;s = str;
			o = obj;s = str;o = obj;s = str;o = obj;s = str;
			o = obj;s = str;o = obj;s = str;o = obj;s = str;
		}
		System.out.println(System.currentTimeMillis() - startTime);
		System.out.println(str);
		System.out.println(o == obj);
	}
}