
JAVA实用类
woder1
这个作者很懒,什么都没留下…
展开
-
JAVA实用类(日期Date类)介绍
一,使用Date类创建日期对象二.SimpleDateFormat定制日期格式三.Calendar类操作日期时间 Date date=new Date(); System.out.println(date); //定制日期格式: SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd-HH-mm:ss"); String now=format.format(date); System原创 2020-11-23 00:20:06 · 240 阅读 · 0 评论 -
JAVA实用类(String类和StringBuffer类)介绍
一.String类型常用的方法有length()方法和equals()方法:length()方法是读取字符串的长度,equals是进行比较,之前介绍过: String b="123456"; System.out.println(b.length()); 结果:6;可以用来判断密码的位数!string.equals()方法主要是将字符串一个一个进行比较,严格区分大小写;但是有些时候我们想要不去区分大小写,这个时候就需要用到String提供的其他一些方法: String原创 2020-11-22 23:49:33 · 141 阅读 · 0 评论 -
JAVA———实用类(Math-Random)介绍
一.Math类介绍Math类的方法有将负数转换成正数;返回二个数的最大值或者最小值,具体的方法可以查询API文档; System.out.println(Math.abs(-12.21)); System.out.println(Math.max(12,11)); System.out.println(Math.min(12,11));Math方法里面最常用的就是生成随机数,Math.random();产生的是0-0.9之间的数字,这种情况我们一般不常用,基本上运用比较多的是原创 2020-11-20 15:12:00 · 150 阅读 · 0 评论