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


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

Re: [foo.bar.Frame] can not inherit from [java.awt.Frame]

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: [foo.bar.Frame] can not inherit from [java.awt.Frame]
Date 2012-04-11 08:24 -0700
Organization A noiseless patient Spider
Message-ID <jm47nd$6en$1@dont-email.me> (permalink)
References <8d7bedc4-30a8-4dc4-97b6-9ddaafc2e16a@l4g2000vbt.googlegroups.com>

Show all headers | View raw


On 4/11/2012 4:56 AM, Maciej Labanowicz wrote:

> Frame.java:2: error: foo.bar.Frame is already defined in this
> compilation unit


I *think* what the compiler is saying using Frame as an unqualified name 
collides with the existing foo.bar.Frame usage.

The solution is just to not use the "import" statement.

package quicktest;

class Frame extends java.awt.Frame {
   public static final long serialVersionUID = 1L;
   public static void main(String [] args) {
     System.out.println("HELLO: args = " + args);
   }
}

If your compiler can find "import java.awt.Frame", then it can find 
java.awt.Frame without the import.  You don't need import, it just 
allows you to shorten the FQN to just the class name.

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


Thread

[foo.bar.Frame] can not inherit from [java.awt.Frame] Maciej Labanowicz <m.labanowicz@gmail.com> - 2012-04-11 04:56 -0700
  Re: can not inherit from [java.awt.Frame] Paul Cager <paul.cager@googlemail.com> - 2012-04-11 05:51 -0700
    Re: can not inherit from [java.awt.Frame] Lew <noone@lewscanon.com> - 2012-04-11 08:13 -0700
      Re: can not inherit from [java.awt.Frame] Paul Cager <paul.cager@googlemail.com> - 2012-04-11 09:37 -0700
  Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-04-11 12:59 +0000
  Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] markspace <-@.> - 2012-04-11 08:24 -0700
    Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Patricia Shanahan <pats@acm.org> - 2012-04-11 09:34 -0700
      Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] markspace <-@.> - 2012-04-11 10:01 -0700
  Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-04-11 11:18 -0700
    Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Lew <lewbloch@gmail.com> - 2012-04-11 12:18 -0700

csiph-web