aspose file tools*
The moose likes Java in General and the fly likes how to check primitive two integers are equal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to check primitive two integers are equal" Watch "how to check primitive two integers are equal" New topic
Author

how to check primitive two integers are equal

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1204
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
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

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

Joined: Aug 15, 2010
Posts: 230
    
    2

What do you mean by "doesn't work" ?
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1204
i do some changes in brackets.but hat is not effected final result.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

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

Joined: Oct 02, 2003
Posts: 11420
    
  16

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

Joined: Nov 25, 2008
Posts: 1204
thanks all.its fine now.I change the variable after the block completed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to check primitive two integers are equal