import java.util.*;
public class Test{
public static void main(String[] args) {
System.out.println(new Date());
String a="ja";
System.out.println(a);
String b="va";
System.out.println(b);
String d="java";
String c=a+b;
System.out.println(c);
if(a==c)
System.out.println("a==c");
else
System.out.println("a!=c");
if(a==d)
System.out.println("a==d");
else
System.out.println("a!=d");
a=a+d;
if(a==c)
System.out.println("a==c");
else
System.out.println("a!=c");
System.out.println("--- Memory Usage:");
Runtime rt = Runtime.getRuntime();
System.out.println("Total Memory = "
+ rt.totalMemory()
+ " Free Memory = "
+ rt.freeMemory());
}
}
运行结果:
Sun Dec 11 13:53:15 CST 2005
ja
va
java
a!=c
a!=d
a!=c
--- Memory Usage:
Total Memory = 2031616 Free Memory = 1686496