Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
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:
Beginning Java
Set a char to empty
Anthony Smith
Ranch Hand
Posts: 285
posted 21 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
char t;
How come I cannot say t = '';
WHat are my alternatives?
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 21 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
char is a primitive type that contains a character value. Asking why it cannot be set to "empty" is like asking why an int can't be set to "empty".
The closest approximation is to set it to the null character a la:
char c = '\0';
hth,
bear
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
please explain. char problem.
char range
Q how does the above code give error and the code below doesn't???
Char assignment
Help needed on following questions
More...