The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Beginner Java help by mikosullivan 2002-03-05 16:56:07
OK, I admit it, I'm stumped. I don't see what I'm doing wrong here.I've been staring at this stupid code for an hour and I don't get it.

I've got this abstract class:

public abstract class Shape {
    
    // members
    protected Point pos;
    

    // abstract methods
    public abstract void show();


    // constructor: using coords
    public Shape(double inX, double inY) {
        move(inX, inY);
    }
    
    // constructor: using point
    public Shape(Point inPoint) {
        move(inPoint);
    }
    

    // move: using coords
    public void move(double newX, double newY) {
        pos = new Point(newX, newY);
    }

    // move: using point
    public void move(Point inPoint) {
        pos = inPoint;
    }

}
That class compiles just fine. Then I try to compile this class, which you will notice extends Shape:
public class Line extends Shape {

    // abstract methods
    public void show() {
        System.out.println("my line");
    }
}
When I try to compile that I get this error:
Line.java:1: cannot resolve symbol
symbol  : constructor Shape  ()
location: class Shape
public class Line extends Shape {
       ^
1 error
WTH? (What the Heck?)

-Miko

[ Reply ]
  I'm a bit rusty... by skeegenin2002-03-05 17:15:38
  Hrm.. by ohlson2002-03-05 18:27:24
  Problems in the Shape class: by Naruki2002-03-05 19:41:43
  Hey, you! by Naruki2006-11-19 12:55:59

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)