swimfan1137 Posted March 30, 2009 Posted March 30, 2009 I keep getting this error. Not sure how to fix it.. Please help me bash-3.00$ javac UpperRightTile.java UpperRightTile.java:48: enum types may not be instantiated Direction newDirection = new Direction(); public class UpperRightTile extends Tile { //Directions public static final Direction DOWN; public static final Direction UP; public static final Direction LEFT; public static final Direction RIGHT; /** * Default Constructor */ public UpperRightTile() { } /** * Determine the direction of the car after traveling through this tile * in the specified direction. * * @param currentDirrection the current direction of the car * @return the new direction of the car */ public Direction newDirection(Direction currentDirection){ Direction newDirection = new Direction(); newDirection = currentDirection; //New Direction if (newDirection == UP){ newDirection = LEFT; }else if (newDirection == LEFT){ newDirection = DOWN; }else if (newDirection == DOWN){ newDirection = RIGHT; }else{ newDirection = UP; } return newDirection; } /** * Retuns a string representation of this tile. * * @return a string representation of the tile. */ public String toString(){ return "1"; } } // UpperRightTile
lakmilis Posted March 31, 2009 Posted March 31, 2009 (edited) would you mind maybe posting Direction file (maybe even Tile file)? also.. for the hell of it.. could you try adding a default action inside the default constructor (so when you call it, it actually instantiates an 'empty' tile) and see if that helps? Although this might be due to empty constructors inside Direction or even Tile file. Edited March 31, 2009 by lakmilis
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now