Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to check primitive two integers are equal

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have two integer primitive values.i need to check whether they are equal.if i use below i doesn't work
int a=5;
int b=5;
if(a==b){
}
 
Henry Wong
author
Marshal
Pie
Posts: 21507
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liyanage wrote:i have two integer primitive values.i need to check whether they are equal.if i use below i doesn't work
int a=5;
int b=5;
if(a==b){
}



What do you mean by "doesn't work"? Are you saying that the code in the conditional (assuming that you add some code) doesn't get called?

Henry
 
Raymond Tong
Ranch Hand
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "doesn't work" ?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i do some changes in brackets.but hat is not effected final result.
 
Henry Wong
author
Marshal
Pie
Posts: 21507
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liyanage wrote:i do some changes in brackets.but hat is not effected final result.



Perhaps it would be a good idea to provide a SSCCE that demonstrates the issue.

Henry
 
fred rosenberger
lowercase baba
Bartender
Posts: 12202
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liyanage wrote:i do some changes in brackets.but hat is not effected final result.

So how do you know it is the if-statement and the comparison, and not the code inside the block that is broken?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks all.its fine now.I change the variable after the block completed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic