java的第一个程序
如果一个包里面含有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()
);
}
}
以上是 java的第一个程序 的全部内容, 来源链接: utcz.com/z/389683.html