Skip to content

Instantly share code, notes, and snippets.

@PandyYang
Created April 10, 2018 14:28
Show Gist options
  • Select an option

  • Save PandyYang/7dc77dff68437e466f7d0fc2db0d167b to your computer and use it in GitHub Desktop.

Select an option

Save PandyYang/7dc77dff68437e466f7d0fc2db0d167b to your computer and use it in GitHub Desktop.
public class AutoBoxDemo4 {
public static void main(String[] args){
Integer i1 = 200;
Integer i2 = 200;
if (i1.equals(i2))//如果用算数运算符 ,会由于integer的缓存机制,导致输出为false
System.out.println("i1==i2");
else
System.out.println("i1 !== i2");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment