Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #26565 > unrolled thread

Re: the true literal

Started bymarkspace <markspace@nospam.nospam>
First post2013-11-21 19:57 -0800
Last post2013-11-21 19:57 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: the true literal markspace <markspace@nospam.nospam> - 2013-11-21 19:57 -0800

#26565 — Re: the true literal

Frommarkspace <markspace@nospam.nospam>
Date2013-11-21 19:57 -0800
SubjectRe: the true literal
Message-ID<l6mko6$8ii$1@dont-email.me>
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;

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web