Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
can we convert /type cast a boolen type to any form???
senthil sen
Ranch Hand
Posts: 184
posted 21 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
can we conver/type cast a boolean type to any form??
Dave Vick
Ranch Hand
Posts: 3244
posted 21 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Senthil
From the
JLS section 5.1.1
The only permitted conversion that involves the type boolean is the identity conversion from boolean to boolean.
Dave
Jim Yingst
Wanderer
Posts: 18671
posted 21 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
However, if you need to you can write your own conversions to do whatever you want - e.g.
public static int booleanToInt(boolean input) { return input ? 1 : 0; }
or
public static String booleanToYeaOrNay(boolean input) { return input ? "YEA" : "NAY"; }
[ October 29, 2002: Message edited by: Jim Yingst ]
"I'm not back." - Bill Harding,
Twister
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Null is not an instanceof Object
Casting
Doubts ...understanding the struts architecture :(
Why is the code giving compiler error
Exception handling: Statements after the finally block
More...