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


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

Re: locals es loco?

Received by 10.224.213.1 with SMTP id gu1mr5991811qab.7.1349377290508; Thu, 04 Oct 2012 12:01:30 -0700 (PDT)
Received by 10.236.192.164 with SMTP id i24mr797748yhn.14.1349377290483; Thu, 04 Oct 2012 12:01:30 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!l8no24874013qao.0!news-out.google.com!e10ni165558057qan.0!nntp.google.com!l8no25388545qao.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Thu, 4 Oct 2012 12:01:30 -0700 (PDT)
In-Reply-To <k4kau4$b01$1@dont-email.me>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
NNTP-Posting-Host 69.28.149.29
References <4b5511c5-799d-4469-9502-cdc39491234b@googlegroups.com> <k4kau4$b01$1@dont-email.me>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <d18b325d-165e-4ce1-96bb-fe43d961a017@googlegroups.com> (permalink)
Subject Re: locals es loco?
From Lew <lewbloch@gmail.com>
Injection-Date Thu, 04 Oct 2012 19:01:30 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.programmer:19104

Show key headers only | 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