motorbike(){
super();
make.setText("Make is: UNKNOWN");
model.setText("Model is: UNKNOWN");
colour.setText("colour is: UNKNOWN");
cost.setText("cost is: UNKNOWN");
length.setText("length is: UNKNOWN");
engine.setText("engine is: UNKNOWN");
fuel.setText("fuel is: UNKNOWN");
height.setText("height is: UNKNOWN");
regno.setText("reistration is: UNKNOWN");
acceleration.setText("acceleration is: UNKNOWN");
add(make);
add(model);
add(colour);
add(cost);
add(length);
add(engine);
add(fuel);
add(height);
add(regno);
add(acceleration);
}
public class car extends motorbike{// Car class, Subclass of motorbike
Label passengers=new Label();
car(){
super();
passengers.setText("Number of passengers is: UNKNOWN");
add(passengers);
}
}
}
public class unpowered extends vehicle{//unpowered class
Label weight=new Label();
unpowered(){
super();
weight.setText("Weight is: UNKNOWN");
add(weight);
}
public class skateboard extends unpowered{//skateboard class, subclass of unpowered
Label width=new Label();
skateboard(){
super();
width.setText("Width is: UNKNOWN");
add(width);
}
}
public class bike extends unpowered{//bike class, subclass of unpowered
Label gears=new Label();
bike(){
super();
gears.setText("The number of gears is: UNKNOWN");
add(gears);
}
}
}
}
}
i cant seem to fix the errors, maily about the super(); bits, and the beginning variables. what have i done wrong?
10-31-2003, 07:41 AM
ArchAngel
Please post any error messages you're getting.
10-31-2003, 08:18 AM
joel112
javac transport.java
transport.java:6: cannot resolve symbol
symbol : class skateboard
location: class transport
skateboard Skateboard1;
^
transport.java:7: cannot resolve symbol
symbol : class skateboard
location: class transport
skateboard Skateboard2;
^
transport.java:8: cannot resolve symbol
symbol : class motorbike
location: class transport
motorbike Motorbike1;
^
transport.java:9: cannot resolve symbol
symbol : class bike
location: class transport
bike Bicycle1;
^
transport.java:10: cannot resolve symbol
symbol : class bike
location: class transport
bike Bicycle2;
^
transport.java:11: cannot resolve symbol
symbol : class car
location: class transport
car Car1;
^
transport.java:12: cannot resolve symbol
symbol : class car
location: class transport
car Car2;
^
transport.java:15: cannot resolve symbol
symbol : class Gridlayout
location: class transport
this.setLayout(new Gridlayout(7.1));
^
transport.java:16: cannot resolve symbol
symbol : class skateboard
location: class transport
Skateboard1=new skateboard();
^
transport.java:18: cannot resolve symbol
symbol : class skateboard
location: class transport
Skateboard2=new skateboard();
^
transport.java:20: cannot resolve symbol
symbol : class motorbike
location: class transport
Motorbike1=new motorbike();
^
transport.java:22: cannot resolve symbol
symbol : class bike
location: class transport
Bicycle1=new bike();
^
transport.java:24: cannot resolve symbol
symbol : class bike
location: class transport
Bicycle2=new bike();
^
transport.java:26: cannot resolve symbol
symbol : class car
location: class transport
Car1=new car();
^
transport.java:28: cannot resolve symbol
symbol : class car
location: class transport
Car2=new car();
^
transport.java:75: cannot reference this before supertype constructor has been called
super();
^
transport.java:94: cannot reference this before supertype constructor has been called
super();
^
transport.java:102: cannot reference this before supertype constructor has been called
super();
^
18 errors
not really sure how to fix them.. pardon if i am a n00b...
10-31-2003, 08:26 AM
ArchAngel
Well, it's clear from the error message that it can't find skateboard (by the way, classes in Java typically have a first capital letter - Skateboard).
You've written your hierarchy in a very strange way, using nested classes. Why? Is it some form of requirement?
If you want to leave it like that, then you'll have to create instances of other classes before you can reach a class from which skateboard is visible.