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: literals and keywords Date: Sat, 28 Dec 2013 08:59:49 -0800 Organization: A noiseless patient Spider Lines: 19 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 28 Dec 2013 16:59:51 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="91501def0eac4f57a6c0156592d51e96"; logging-data="8120"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yWVYaVYRqXs6Dzl6dDHpoNN4frgfjecw=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: Cancel-Lock: sha1:bfH1RSwhFzEHIekLMpyWyutgW3s= Xref: csiph.com comp.lang.java.programmer:27096 On 12/28/2013 8:15 AM, Stefan Ram wrote: > Does it matter? > > Can you find any program, where one can observe the difference? > E.g., some program that does compile because they are not keywords, > but would not compile when they were keywords, or vice versa? > Or are there any other observable consequences of this difference? > Yes, it matters, or they wouldn't make a distinction. We talked about this already: literals can be used in expressions, keywords can't. The observable difference is in the implementation of the JLS. You can write "int i = 1 + 2;" but you can't write "Object o = for + try;" because that section of the JLS says so. Read it.