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


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

Re: the true literal

From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.programmer
Subject Re: the true literal
Date 2013-11-21 19:57 -0800
Organization A noiseless patient Spider
Message-ID <l6mko6$8ii$1@dont-email.me> (permalink)
References <true-20131122032105@ram.dialup.fu-berlin.de>

Show all headers | View raw


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;

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web