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


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

Re: locals es loco?

Newsgroups comp.lang.java.programmer
Date 2012-10-04 12:01 -0700
References <4b5511c5-799d-4469-9502-cdc39491234b@googlegroups.com> <k4kau4$b01$1@dont-email.me>
Message-ID <d18b325d-165e-4ce1-96bb-fe43d961a017@googlegroups.com> (permalink)
Subject Re: locals es loco?
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Eric Sosman wrote:
> bob smith wrote:
>> I'm trying to come up with a mnemonic that helps me remember which
>> variables get auto-initialized in Java.  Is it just locals that you have to explicitly initialize?> 

>      Fields (both instance fields and static fields) are always
> initialized to zero/false/null as appropriate.
> 
>      Parameters of methods and constructors are always initialized
> by the caller's argument expressions.
> 
>      The variable in a `catch' clause is initialized to refer to
> whatever was thrown.
> 
>      Nothing else is initialized until and unless you initialize it.

http://docs.oracle.com/javase/specs/jls/se7/html/jls-16.html
http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.3.2
http://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.3.1

-- 
Lew

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


Thread

locals es loco? bob smith <bob@coolfone.comze.com> - 2012-10-04 07:50 -0700
  Re: locals es loco? markspace <-@.> - 2012-10-04 08:09 -0700
  Re: locals es loco? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-10-04 11:45 -0400
    Re: locals es loco? Lew <lewbloch@gmail.com> - 2012-10-04 12:01 -0700
  Re: locals es loco? Roedy Green <see_website@mindprod.com.invalid> - 2012-10-05 00:06 -0700
    Re: locals es loco? Lew <lewbloch@gmail.com> - 2012-10-05 10:55 -0700
      Re: locals es loco? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-10-05 19:01 +0000
        Re: locals es loco? Lew <lewbloch@gmail.com> - 2012-10-05 12:41 -0700
      Re: locals es loco? Roedy Green <see_website@mindprod.com.invalid> - 2012-10-05 15:38 -0700

csiph-web