Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.utanet.at!newscore.univie.ac.at!aconews-feed.univie.ac.at!aconews.univie.ac.at!not-for-mail Newsgroups: comp.lang.java.programmer From: Andreas Leitgeb Subject: Re: Using Enumerated Types as Array Indexes References: <4e4b0d81$0$314$14726298@news.sunsite.dk> <4e4b1fe4$0$314$14726298@news.sunsite.dk> <6d418cda-dab3-43df-a9ec-293b43f2bbd8@glegroupsg2000goo.googlegroups.com> Reply-To: avl@logic.at User-Agent: slrn/pre0.9.9-111 (Linux) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-ID: Date: 17 Aug 2011 13:28:18 GMT Lines: 20 NNTP-Posting-Host: gamma.logic.tuwien.ac.at X-Trace: 1313587698 tunews.univie.ac.at 71616 128.130.175.3 X-Complaints-To: abuse@tuwien.ac.at Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7159 Arved Sandstrom wrote: > On 11-08-17 12:45 AM, Lew wrote: >> On Tuesday, August 16, 2011 8:20:05 PM UTC-7, markspace wrote: >>> On 8/16/2011 6:56 PM, Arne Vajh�j wrote: >>>> byte/short/int/long integer types >>> OK, you mean for indexes? char works too, and long really doesn't -- it >>> has to be cast to an int. [...] >> JLS 10: [...] >> IOW, you never index arrays with a byte, char or short. [...] > I'm feeling slow this morning: how do we get problems with byte->int, > short->int, or char->int again? array-indexing takes integers. That you can also throw byte/short/char values at them without cast doesn't mean that arrays "take" those, but only that such values get automatically converted to int before being taken by the array for indexing. An example for something really "taking" byte-values: foo(byte b) { ... }