Re: [foo.bar.Frame] can not inherit from [java.awt.Frame]
On 4/11/2012 8:24 AM, markspace wrote:
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.
I think a better solution would be to rename foo.bar.Frame. If it did
not have some functional difference from java.awt.Frame, it would not
exist. Presumably, it is Frame specialized in some way, and its name
should indicate that specialization.
Patricia