0

Hi,

I have a program that has a package that is imported in a class called Control.All the files are compiling correctly apart from when I try to import a package.

I am importing the package by

package carpkg;

and in my main there is

GUI gui = new GUI

but when I try to compile i get the error:

Bad class file: .\carpkg\GUI.class
class file contains wrong class: GUI

Does anyone have any idea how I might fix this?

Edited by StaticX: n/a

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Gerbiler
0

Well what is the definition of GUI.class? The problem is probably that GUI.class isn't defining package carpkg; at the top of the file. or it could be that

GUI gui = new GUI

is missing it's ();

0

the GUI() was a typo I made while posting here.What do you mean by the definition of the GUI class?If you are asking what it does it is an interface.

i have also tryed importing pakage and this too does not work.

0

you cannot create an object from an interface.

public interface GUI{
public void showGUI();
}
public class blueGUI implements GUI {
public void showGUI(){
//somehow show gui in blue
}
}
GUI gui = new GUI();//WILL NOT WORK. cannot instantiate interface
blueGUI gui = new blueGUI();//WILL WORK
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.