Objects

Objects


1. Summary


2.

The equals method of equals Object is prone to throwing null pointer exceptions. You should use constants or objects with certain values ​​to call equals

	public static boolean equals(Object obj, Object obj1) {
		return obj == obj1 || obj != null && obj.equals(obj1);
	}


1. When calling the equals method, the constant is usually placed on the left, and the equals method of the constant is called to prevent the variable from being empty

2. Using the above method, the constant is used as the first parameter

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326724452&siteId=291194637
Recommended