db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Nielsen <Thomas.Niel...@Sun.COM>
Subject Re: Returning NULL from a database-side Java function
Date Tue, 09 Oct 2007 17:55:08 GMT
Bryan Pendleton wrote:
>>>> 1. Why does int pop = 0 == 0 ? 1 : null; even compile?
>
> For what it's worth, it doesn't compile for me:
>
works with 1.5.0-13:
C:\Program Files\Java\jdk1.5.0_13\bin>javac c:\tmp\pop.java
C:\Program Files\Java\jdk1.5.0_13\bin>

even with 1.5.0-07:
C:\Program Files\Java\jdk1.5.0_07\bin>javac c:\tmp\pop.java
C:\Program Files\Java\jdk1.5.0_07\bin>

1.6.0-03 works as well:
C:\Program Files\Java\jdk1.6.0_03\bin>javac c:\tmp\pop.java
C:\Program Files\Java\jdk1.6.0_03\bin>

but 1.4.2-15 does not:
C:\Program Files\Java\jdk1.4.2_15\bin>javac c:\tmp\pop.java
c:\tmp\pop.java:5: incompatible types
found   : <nulltype>
required: int
        int pop = 0 == 0 ? 1 : null;
                               ^
1 error
C:\Program Files\Java\jdk1.4.2_15\bin>


Ooops - didn't see Ricks reply until now...

Certainly something introduced in Java 5.

Thomas

Mime
View raw message