java - Just need some enlightenment about .equals -


this question has answer here:

integer = new integer(1); integer b = new integer(1); long c = new long(1);  system.out.println(a.equals(b)); system.out.println(a.equals(c)); 

question why a.equals(c) gives false?

from integer.equals():

the result true if , if argument not null , integer object contains same int value object.

c not integer, a.equals(c) returns false.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -