Article View: comp.lang.java.programmer
Article #298Re: Bizarre import weirdness
From: John R. Antley
Date: Tue, 04 Dec 2001 23:18
Date: Tue, 04 Dec 2001 23:18
24 lines
2277 bytes
2277 bytes
Hi Ron, Jon is right. The 'import <package>.*' statement does nothing AT RUN TIME. This makes the die-hard Java enthusiasts very happy [no conditional compilation]. At COMPILE TIME is a different story... Per your example, the compiler doesn't know which Date object you mean. It merely ASSUMES what imports have told it are true. If not [say, you change a method, and somehow its .class doesn't get recompiled, you have an old .JAR which doesn't match an import, or whatever], you get a RUNTIME EXCEPTION [when the .class bytecodes are being interpreted]. There's a major difference between the old, compiled languages [Modern Basic (including VB), Pascal, C, C++, etc.] vs. the newer interpreted bytecode/script kind of theory [Java, C# (Java ripoff), Python, Perl, JavaScript]. The former rely on COMPILE TIME LINKING and the latter on RUN TIME CLASS RESOLUTION. Both have distinct advantages beyond the scope of this thread. Sorry; I didn't mean to insult your intelligence. The discussion just turned on a light bulb for and old C/C++ jockey I thought I'd try to articulate. HTH, JR
Technical Details
Message-ID:
<3C0D59E3.E4A7719E@mindspring.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mailReferences:
<612q0uggd5qbghbdj3dm16vet63el85a34@4ax.com> <MPG.1677224fb3f43e5198a676@mrmog.peramon.com> <2fbq0uc3fvvu49ro53j1pq2mip7nff83bg@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a146,b03b9f2c50f270a6 X-Google-Attributes: gid10a146,public X-Google-Thread: fa3e3,b03b9f2c50f270a6 X-Google-Attributes: gidfa3e3,public X-Google-ArrivalTime: 2001-12-04 15:14:02 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: "John R. Antley" <jrantley@mindspring.com> Newsgroups: comp.lang.java.programmer,borland.public.jbuilder.ide Subject: Re: Bizarre import weirdness Date: Tue, 04 Dec 2001 16:18:59 -0700 Organization: JRLabs Software Lines: 27 Message-ID: <3C0D59E3.E4A7719E@mindspring.com> References: <612q0uggd5qbghbdj3dm16vet63el85a34@4ax.com> <MPG.1677224fb3f43e5198a676@mrmog.peramon.com> <2fbq0uc3fvvu49ro53j1pq2mip7nff83bg@4ax.com> NNTP-Posting-Host: c7.ae.e1.7b Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 4 Dec 2001 23:13:26 GMT X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.12 i686) X-Accept-Language: en