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
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 42
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

Joined: Sep 08, 2007
Posts: 2925
    
  15

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: 19216

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
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.
 
Similar Threads
Accessing Global Variable...
Help , can any one explain the output ?
problem with oops method::
Need explanation for the code
explain this ...please