PieceFactoryImplementation: cannot be resolved to a type

Whenever I try to call the method PieceFactoryImplementation from MyTetrisFactory.java class, I get the error PieceFactoryImplementation cannot be resolved to a type. How do I resolve this?

I think, you need to import the class PieceFactoryImplementation first.

This is what I’ve done till now, I’m not sure what other class I need to import:

`package tetris.game.pieces;

import java.util.Random;
import tetris.game.pieces.Piece.PieceType;`

The class to import is PieceFactoryImplementation.

Thank you, it worked (:

for further problems of this kind I recommend typing in the class name except for the last letter and then press the auto complete (tabulator) button, this should automatically import the class that you auto-completed

2 Likes

In general, your IDE (VSCode) should automatically import these, or at least suggest that you do. If that does not seem to work for you, you should visit the office hour, since writing code without this automation is much too painful :slight_smile:

2 Likes