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 How to modify this program to use & display 1s and 0s instead of true and false? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "How to modify this program to use & display 1s and 0s instead of true and false?" Watch "How to modify this program to use & display 1s and 0s instead of true and false?" New topic
Author

How to modify this program to use & display 1s and 0s instead of true and false?

bill kim
Greenhorn

Joined: Nov 10, 2011
Posts: 2
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2



Call this method to convert a boolean to an int in the way you described.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Hi and welcome to the JavaRanch.

I've edited your post and added code tags making it much easier to read. Please do so in the future.

We are NotACodeMill, what have you tried? What failed? And why?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
bill kim
Greenhorn

Joined: Nov 10, 2011
Posts: 2
Thank you guys!!

Paul Clapham, where should I put your code? and why?

Wouter Oet, I'll follow the rule in the future. Well, I'm trying to use and show 1s and 0s instead of true and false. I've replaced true to 1 and false to 0.
compiler says "incompatible types. found: int, required: boolean"
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You need to use it where you want the output, so:

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to modify this program to use & display 1s and 0s instead of true and false?
 
Similar Threads
Private method overriding
Casting Boolean
assigning int types to a boolean expression
Another newbie question
Static Methods Problem