-
Dodgy class
I made this class:
class InOb {
int i, j;
boolean pass = true;
public InOb(int si, int sj) {
i = si;
j = sj;
}
public void drs(Graphics g, int xplus, int yplus, Container cont) {
tileIcon.paintIcon(cont, g, xplus, yplus);
g.drawLine(xplus, yplus, xplus + 50, yplus);
g.drawLine(xplus, yplus, xplus, yplus + 50);
g.drawLine(xplus + 50, yplus + 50, xplus + 50, yplus);
g.drawLine(xplus + 50, yplus + 50, xplus, yplus + 50);
g.drawString("its" + i + " " + j, xplus + 5, yplus + 30);
}
}
works fine.
But:
class Bush extends InOb {
public void drs(Graphics g, int xplus, int yplus) {
g.drawLine(xplus, yplus, xplus + 50, yplus);
g.drawLine(xplus, yplus, xplus, yplus + 50);
g.drawLine(xplus + 50, yplus + 50, xplus + 50, yplus);
g.drawLine(xplus + 50, yplus + 50, xplus, yplus + 50);
g.drawString("its" + i + " " + j, xplus + 5, yplus + 30);
}
}
doesn't work - it says:
Move/Move.java [39:1] cannot resolve symbol
symbol : constructor Bush (int,int)
location: class Move.Bush
bits [0] [i] = new Bush(0, i);
^
Move/Move.java [143:1] InOb(int,int) in Move.InOb cannot be applied to ()
class Bush extends InOb {
^
2 errors
Errors compiling Move.
please help!
JJS
Penguins Rule!
-
symbol : constructor Bush (int,int)
location: class Move.Bush
bits [0] [i] = new Bush(0, i);
means that you are trying to create an object of class type "Bush" by passing it 2 int values. This wont work becuase you need to define a constructor for that class that takes 2 int values as parameters.
In other words, it is looking for a constructor in the class "Bush" that it cant find
as for the second error i think your going to have to show us more code, it looks like it is trying to apply some sort of calculation or something on an erronous type, maybe just a syntax error somewhere, but im not sure, ill leave it open for someone to have a crack at
A kram a day keeps the doctor......guessing
-
never mind-
i've solved it now - i had do add the constructor with super(InOb(si, sj));
which works
JJS
Penguins Rule!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks