如果一個包裡面含有main,都可以作為一個單獨的程式來執行。
使用java application
1.
package src;
import java.util.*;
public class second {
public static void main(String[] args){
System.out.println(new Date());
Properties p = System.getProperties();
System.out.println("---Memory Usage22222222222");
p.list(System.out);
Runtime rt = Runtime.getRuntime();
System.out.println("Total Memory = "
+ rt.totalMemory()
+ " Free Memory = "
+ rt.freeMemory()
);
}
}
2.
package first;
import java.util.*;
public class name {
public static void main(String[] args){
System.out.println(new Date());
Properties p = System.getProperties();
p.list(System.out);
System.out.println("---Memory Usage");
Runtime rt = Runtime.getRuntime();
System.out.println("Total Memory = "
+ rt.totalMemory()
+ " Free Memory = "
+ rt.freeMemory()
);
}
}