Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 05 May 2011 08:11:11 -0500 Date: Thu, 05 May 2011 06:11:03 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: char to decimal References: <92ea64F3avU1@mid.individual.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <9pednRnBeuxtPF_QnZ2dnUVZ_uGdnZ2d@earthlink.com> Lines: 25 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.8.126.96 X-Trace: sv3-vjZCksYJbOQPHUEHny5jIzC9IF81ncBBnqBu/tDAeEeyhzSH3ttxHK33TfyS2eNzU5QvfMR9/gh64xq!1JxTdVrWMgdwJm4fwrRnmR7NhLZ7Rm4rfYZDb8YC6u6WYO+bUwjJzCflLcLRbGVrXrQqDe5l38j8!yg7ig7pynUR3Chsv372LrDHG4h18okYDLhoZrWNlvxY= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2327 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3557 On 5/5/2011 4:18 AM, Andreas Leitgeb wrote: > Lew wrote: >> Lawrence D'Oliveiro wrote: >>> Ian Shef wrote: >>>> A char is much like an int except that: >>>> It has 16 bits instead of 32. >>>> It is unsigned, with a value from 0 through 65535. >>>> It gets special handling in some places, such as by System.out.println. >>>> The special handling by System.out.println can be avoided by casting to an >>>> int. >>> Funny, they could do all this for char, but not for boolean. >> Booleans are not numbers. > > But characters are. So, 'a' is just as naturally 97 as true isn't 1 > I would phrase it slightly differently. There is a strong natural association between a character and the numeric value of its Unicode representation. There are several different ways of mapping between the two Boolean values and integers, especially considering the fact that the smallest integer type in Java has 256 different values, and Boolean only has two. Patricia