I am a beginner, taking a CompSci class in school. This chapter is making subclasses; however, The class is somehow causing the program to terminate. The world doesn't even appear, and there are no errors. (I am running Eclipse).
Here is my code:
package karel;
import kareltherobot.*;
public class Race implements Directions
{
public static void main(String args[]) {
class Car extends UrRobot
{ public Car(int street, int avenue, Direction direction, int beepers)
{super(5, 5, East, infinity);
}
public void turnAround()
{
turnLeft();
turnLeft();
}
public void turnRight()
{
turnLeft();
turnLeft();
turnLeft();
}
}
{
World.setVisible(true);
World.showSpeedControl(true);
}
{
Car kar = (Car) new UrRobot(5, 5, East, infinity);
kar.move();
kar.turnLeft();
kar.move();
kar.turnAround();
kar.move();
kar.turnRight();
}
}
}
Is there a way to get this program to not error to termination?