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


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

Re: You put because it is not there

From Arved Sandstrom <asandstrom2@eastlink.ca>
Newsgroups comp.lang.java.programmer
Subject Re: You put because it is not there
References <error-message-20140127232916@ram.dialup.fu-berlin.de> <mcmurtrie-A8FF22.21325427012014@c-61-68-245-199.per.connect.net.au>
Message-ID <0vNFu.291714$WT.111712@fx32.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2014-01-28 08:36 -0400

Show all headers | View raw


On 01/28/2014 01:32 AM, Kevin McMurtrie wrote:
> In article <error-message-20140127232916@ram.dialup.fu-berlin.de>,
>   ram@zedat.fu-berlin.de (Stefan Ram) wrote:
>
>>    Sometimes, it is surprising what error messages Java
>>    implementations give:
>>
>> Main.java:3: error: '.class' expected
>>            { if( true )int x; }}
>>                            ^
>>    Does the implementation really expects to see
>>    »if( true )int .class« or »if( true ).class«?
>>
>>    The complete source code was:
>>
>> public final class Main
>> { public static void main( final java.lang.String[] args )
>>    { if( true )int x; }}
>
> Eclipse's suggestions turned that into:
>     if (true) assert int.class != null;
>
> I didn't know primitives had a synthetic class field.  I tried it and
> found that int.class is a shortcut for Integer.TYPE.
>
[ SNIP ]

FWIW I didn't know this either. I also had to quickly fire up a quick 
test program to try it out. :-) Learn something new every day.

AHS
-- 
When a true genius appears, you can know him by this sign:
that all the dunces are in a confederacy against him.
-- Jonathan Swift

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


Thread

Re: You put because it is not there Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2014-01-27 21:32 -0800
  Re: You put because it is not there Arved Sandstrom <asandstrom2@eastlink.ca> - 2014-01-28 08:36 -0400

csiph-web