67,513
社区成员
发帖
与我相关
我的任务
分享
但list没实例化。
List list = null;
list.size();
Exception:
java.lang.NullPointerException
/**
* Returns the number of elements in this list.
*
* @return the number of elements in this list
*/
public int size() {
return size;
}
/**
* Returns <tt>true</tt> if this list contains no elements.
*
* @return <tt>true</tt> if this list contains no elements
*/
public boolean isEmpty() {
return size == 0;
}
public boolean isEmpty() {
return size() == 0;
}