We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.out.println(new Integer(128) == new Integer(128)); prints false but System.out.println(new Integer(127) == new Integer(127)); prints true
System.out.println(new Integer(128) == new Integer(128));
false
System.out.println(new Integer(127) == new Integer(127));
true
Explanation: http://stackoverflow.com/questions/1700081/why-does-128-128-return-false-but-127-127-return-true-when-converting-to-integ
The obvious conclusion: never rely on two references being identical, always compare them with .equals() method.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
System.out.println(new Integer(128) == new Integer(128));
printsfalse
but
System.out.println(new Integer(127) == new Integer(127));
printstrue
Explanation: http://stackoverflow.com/questions/1700081/why-does-128-128-return-false-but-127-127-return-true-when-converting-to-integ
The text was updated successfully, but these errors were encountered: