File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes need help for the If condition. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help for the If condition." Watch "need help for the If condition." New topic
Author

need help for the If condition.

Joy Vergis
Ranch Hand

Joined: Sep 14, 2009
Posts: 45
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
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Did you notice in your program- Both the statements print the same message


Mohamed Sanaulla | My Blog
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

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.>


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Adrabi Abderrahim
Greenhorn

Joined: Jan 23, 2011
Posts: 8

hello,

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

to
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help for the If condition.