-------android培训、java培训、期待与您交流! ----------
public class SystemDemo {
/**
* @param args
* 11.15
* @throws IOException
* @throws InterruptedException
* DATE 类 -------- Math 类-------Calendar 类------
*/
public static void main(String[] args) throws IOException,
InterruptedException {
// TODO Auto-generated method stub
// Properties pp = System.getProperties();
// 确定当前的系统属性
// System.out.println(pp.toString().replaceAll(",", "\n"));
// 调用 Hashtable 的方法 put。使用 getProperty 方法提供并行性。强制要求为属性的键和值使用字符串。
// 返回值是 Hashtable 调用 put 的结果。
// 在系统内定义特定信息。
// System.setProperty("01", "java=======================");
// Runtime r = Runtime.getRuntime();
// r.exec("C:\\Program Files\\Outlook Express\\setup50.exe");
// Process pr = r.exec("winmine.exe"); //扫雷
// Thread.sleep(400000);
// pr.destroy();
// Date d = new Date();
// System.out.println("计算系统当前的日期"+d);
// long l = d.getTime();
// System.out.println("获得毫秒数"+l);
// SimpleDateFormat sd = new
// SimpleDateFormat("yyyy年mm月dd日 E a hh :mm:ss 第k个小时 Z ");
// System.out.println("格式化日期数据"+sd.format(d));
Calendar c = Calendar.getInstance();
sop(c.get(Calendar.YEAR) + "年"
+ ("得到系统当前的日期" + c.get(Calendar.MONTH) + 1) + "月"
+ c.get(Calendar.DAY_OF_MONTH) + "日");
int i = Math.abs(-45);
System.out.println("值的绝对值,针对负数取值为相反数,正数为本身" + i);
// double l = Math.random();
for (int x = 0; x < 10; x++) {
int it = (int) (Math.random() * 10);
System.out.println("可产生随机数用for循环输出10项" + it);
}
}
public static void sop(Object obj) {
System.out.println(obj);
}
}
-------android培训、java培训、期待与您交流! ----------
详细请查看:http://edu.youkuaiyun.com/heima/