java - Some equal condition didn't work -


this question has answer here:

why equal operator dosn't work in case :

integer act0 = integer.valueof(ac.split("-")[0]); if (activite_alerte.getactivite().getidactivite() == act0)) {     add_notif(profil, ao);     added = true;     break; } 

activite_alerte.getactivite().getidactivite() , act0 equals 439 didn't work other value work.

you're using boxed integral type integer. java permits equality using == values in range -128 +127 since these "canned" boxed values, reference comparison work numbers in range. number - 439 - big.

you should use .equals() instead boxed types.

personally find 1 of pernicious aspects of java.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -