API其他函数 ,system date,..

System:
  out:标准输出流,默认的对应设备是显示器
  int: 标准输入流,默认设备是键盘
 
 System.getProperties(); 获取到的系统信息存储到Properties键值集合中
 
 Properties prop =System.getProperties();
Set<String> keySet=prop.stringPropertyName();

****Runtime 就是单例设计模式的对象

Runtime r= Runtime.getRuntime();
r.exec("winmine.exe");

****Math******

 int d=(int)Math.ceil(Math.random()*6); // 1~6

日期的格式化:
   想要把日期按照我们的习惯格式化一下,找到了DateFormat
 Date date = new Date()
// 通过DateFormat 类的静态工厂方法获取实例

 DateFormat dateFormat= DateFormat.getDateInstance(DateFormat.Full);
;

 // 转成自定义格式,xxx/xx/xx ,自定义对象,只有子类
dateFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");

//使用DateFormate的format 方法对日期对象进行格式化。//将日期对象转成日期格式的字符串

 String str_date =dateFormat.format(date);
 c.set(Calender.YEAR,2014);
 c.set(2014,2,1);
 c.add(Calendar.DAY_OF_MONTH,-1);  //向左偏移一天




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值