Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35695
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Forward references |
| Date | 2016-10-02 19:59 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <nss71q$btl$1@gioia.aioe.org> (permalink) |
| References | <C-20161002162949@ram.dialup.fu-berlin.de> |
On 10/2/2016 11:45 AM, Stefan Ram wrote:
> An old C compiler from the 70s is a one-pass compiler IIRC,
> so it does not do "forward references".
>
> I am used so much to this, that I actually was not sure
> whether in Java the following program is correct:
>
> class A implements B {}
>
> interface B {}
> In the first line, we use an interface that will be
> define only later!
>
> Turns out, Java accepts this.
I am not surprised.
javac take a sort of global approach to compilation.
And I am pretty sure that you have written code where
A refer to B and B refer to A. And it worked fine
without any special declarations.
Arne
Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread
Re: Forward references Arne Vajhøj <arne@vajhoej.dk> - 2016-10-02 19:59 -0400
csiph-web