jsp - how can java return false when comparing 2 numbers which has exactly the same type and value? -



jsp - how can java return false when comparing 2 numbers which has exactly the same type and value? -

this question has reply here:

why equals() method when have == operator? [duplicate] 8 answers <br><% if (overlimit != null) {%><%=overlimititemno.getclass().equals(shoppingvo.getitem_no().getclass())%><%}%> <br><% if (overlimit != null) {%><%=overlimititemno.getclass()%> vs <%=shoppingvo.getitem_no().getclass()%><%}%> <br><% if (overlimit != null) {%><%=overlimititemno%> vs <%=shoppingvo.getitem_no()%><%}%> <br><% if (overlimit != null) {%><%=overlimititemno == shoppingvo.getitem_no()%><%}%>

and shows next on browser

true

class java.lang.integer vs class java.lang.integer

300008 vs 300008

false

you need utilize obj1.equals(obj2). == on objects compares whether 2 same exact instance

java jsp

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -