Arrays.toString(files) 系统的遍历输出数组的方法。
System类
系统类(不能被实例化)
public static void gc() //垃圾收集
public static void exit(int status) //退出程序
public static Properties getProperties() //获取当前系统参数,超级长。
Object类
public final Class<?> getClass() 返回此 Object 的运行时类(当时不能当成类名那样用去强制转换)
toString() 默认把地址转成字符串
hashCode()获取哈希值,对象不同返回值不同,后期要重写为内容不同哈希值不同.默认是把地址转成十进制输出出来.
a.equal(b)比较a和b是否相等,不重写的话默认比较地址,所以必须重写
.clone() 创建并返回此对象的一个副本
@Override
public boolean equals(Object obj) {//重写模板
//this :s obj :s1
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Student other = (Student) obj;
if (age != other.age)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
评论区