摘要:
牢记一点:要么指定大小,要么直接赋值.二选一 int [] arr=new int[3]; int[] arr = {1,2,3}; int[] arr = new int[] {1,2,3}; 阅读全文
摘要:
equals方法 1 public boolean equals(Object anObject) { 2 if (this == anObject) { 3 return true; 4 } 5 if (anObject instanceof String) { 6 String anotherS 阅读全文
摘要:
分三种情况 1.尾节点指向null(链表无环) 2.尾节点指向头结点 2.尾结点指向非头结点 思路 设置两个指针,a跑的快,b跑的慢,如果链表有环,那么当程序执行到某一状态时,a==b。如果链表没有环,程序会执行到a==NULL,结束。 1 listnode slow=head;// //链表第一个 阅读全文