try-with-resources and null resource
Llewellyn Falco
isidore at setgame.com
Mon Jan 24 14:32:58 PST 2011
My option is; although this is odd code, it should not through an NPE
exception.
On Mon, Jan 24, 2011 at 12:20 PM, Joe Darcy <joe.darcy at oracle.com> wrote:
> Print "hello from inside" and then throw an NPE from calling close on the
> null resource. (Beforehand, javac will warn you don't use variable c inside
> the block.)
>
> -Joe
>
>
> Llewellyn Falco wrote:
>
>> What should the following do?
>> Llewellyn
>>
>> Try(AutoCloseable c = null)
>> {
>> System.out.print("hello from inside");
>> }
>>
>>
>>
More information about the coin-dev
mailing list