Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: the true literal Date: Thu, 21 Nov 2013 19:57:54 -0800 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 22 Nov 2013 03:57:58 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="9358cda03e1e0dfd3c4b757daa608707"; logging-data="8786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/n8Ml3S2IXZUOdRSkS4K7FeDANUvIXZqg=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 In-Reply-To: Cancel-Lock: sha1:8jteGThWc1/+6116HZZjziwHjeg= Xref: csiph.com comp.lang.java.programmer:26565 On 11/21/2013 6:24 PM, Stefan Ram wrote: > The JLS says: > > »While true and false might appear to be keywords, > they are technically Boolean literals (§3.10.3).« > > What is a keyword? > > I used to think that a keyword is a words whose meaning is > given by the language specification and that cannot be > declared as an identifier in source code. I believe that all > of this applies to »true«. So, why then it is not called a > keyword in Java? > I think maybe this is an issue for language purists, but if you think of 'true' and 'false' as values, then obviously they're literals. Keywords have no value, and can't be assigned or used in an expression. int i = for; Makes no sense. + and - aren't keywords, they're operators. Different word again for different thing. So 'true' might look like a keyword, but it's really like 1 or 3.0 or null. It represents a value that can be assigned or used in an expression. true | false;