摘要:
1.“==”与equals的区别 == 是引用是否相等,equals是内容相等 Integer a = new Integer(1); Integer b = new Integer(1); if (a = b)... //错误 if(a.equals(b))... //正确 public clas 阅读全文
摘要:
1.实现Runnable接口 class Run implements Runnable { @Override public void run() { for (int i = 0; i < 10; i++) { System.out.println("i =" + i); } }} 启动实现Ru 阅读全文
摘要:
1.当一个类需要按照多线程的方式处理时,只需要继承Thread即可,还要覆盖该类的run()方法 定义:public void run() //继承Thread类 public class MyThread extends Thread{ @Override public void run(){ f 阅读全文
摘要:
1.Comparable 接口的定义: public interface Comparable<T>{ public int compareTo(T o) } 接口中只有一个 compareTo 方法,该方法返回一个 int 类型的数据,但是 int 的值只能是3种: *1:表示大于 *-1:表示小 阅读全文