This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes how to initialize char?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to initialize char??" Watch "how to initialize char??" New topic
Author

how to initialize char??

yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
how to initialize it?

like string is null int is 0

how about char?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8914
    
    8

Have a look at The Java Tutorial: Primitive Data Types.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
char '\u0000' its given there!!!

how about simple programs ??
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39053
    
  23
'\u0000' is a valid char. Its bit value is 0000_0000_0000_0000, and it is called the null character. You can find it on this Unicode chart.

You initialise a char exactly the same way you initialise anything else; put it to the left of an assignment operator (=) and put a char literal or an expression which is convertible to a char on the right of that, then a ; sign.
 
GeeCON Prague 2014
 
subject: how to initialize char??