I have two files: Validador.java
and Peca.java
. This is what I have in my Validador:
public class Validador {
public static void main(String[] args) {
if(args.length == 0) {
Peca p = new Rainha("t",1,2);
}else if (args[0].equals("filtro")) {
}
}
}
Peca:
public abstract class Peca {
public static class Rainha extends Peca {
Rainha(Tabuleiro tab, int linha, int coluna) {
}
}
public static class Nada extends Peca {
Nada(Tabuleiro tab, int linha, int coluna) {
}
}
}
I am getting this error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Rainha cannot be resolved to a type
at Validador.main(Validador.java:5)
How can I fix my Peca in order to be possible to call Rainha like this?
Peca p = new Rainha("t",1,2);
Thanks
You must either import Peca.Rainha or write Peca p = new Peca.Rainha("t",1,2);