• Post Reply Bookmark Topic Watch Topic
  • New Topic

need help for the If condition.  RSS feed

 
Joy Vergis
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I get the output for the below program as
The value of a:0




The default value for int types is 0. So why i get output for only a.
 
Mohamed Sanaulla
Bartender
Posts: 3169
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you notice in your program- Both the statements print the same message
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a and b are both 0. That means that a<b is false, so the else statement is executed. And although you're printing the value of b (0) you say it's the value of a. Just check the String.>
 
Adrabi Abderrahim
Greenhorn
Posts: 8
Eclipse IDE Fedora Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

Change "a" in line 9 to "b" :

to
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!