Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.help Subject: Re: expected error Date: Fri, 23 Sep 2011 17:56:25 -0700 (PDT) Organization: http://groups.google.com Lines: 53 Message-ID: <20643304.220.1316825785758.JavaMail.geo-discussion-forums@prng5> References: <7371102.30.1316805058374.JavaMail.geo-discussion-forums@prec11> Reply-To: comp.lang.java.help@googlegroups.com NNTP-Posting-Host: 67.218.102.230 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1316826800 20372 127.0.0.1 (24 Sep 2011 01:13:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 24 Sep 2011 01:13:20 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=67.218.102.230; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:1125 On Friday, September 23, 2011 5:10:11 PM UTC-7, Roedy Green wrote: > On Fri, 23 Sep 2011 12:10:58 -0700 (PDT), Lew > wrote, quoted or indirectly quoted someone who said : >=20 > > public interface NumList { > > void printArray(); > > } > > > >The coaching might have been phrased, "Method declarations must specify = the return type, or 'void' if nothing is to be returned." > > > >So I don't see "executable code" in the declaration, but "method defined= without return type". Either way it needs to be fixed. >=20 > I think "executable code" is one of several ways of interpreting the > error.=20 >=20 > printArray(); >=20 > From a bottom up point of view looks to it like an attempt to invoke > the method printArray() which may be undefined. >=20 > I agree though your interpretation of the error fits better with what > the author intended. Someday compilers might expend effort to decide > how to interpret errors. I wrote > http://mindprod.com/jgloss/compileerrormessages.html > to at least give programmers several alternate interpretations > to choose from. Actually, your interpretation was an eye-opener for me, Roedy. You are exa= ctly right - depending on how you approach the code it looks either like an= uncompilable declaration or an uncompilable command. It reminds me of the= figure/ground optical illusion that appears to be a crone or a young lady = depending on how your brain organizes what you see. This can be very useful to the OP - I infer that her difficulty was the con= flation of the two concepts, declaration and invocation, hence the ambiguit= y in the syntax. If true, the insight is that declaration occurs in a diff= erent place from invocation. You declare a method in an interface (or abst= ract class). You both declare it with the signature and define it with a m= ethod body in the implementing class. You invoke a method from inside (the= body of) another method or constructor, which can be of the same class or = another class. Declare, define, invoke. When you get further along in your studies, you'll see that as interface, i= mplementing class, client method. Good question and interesting insights from Roedy. --=20 Lew