0
I’m starting to study java and after observing the creation of some objects I decided to try to create my own. already in the first I found this error that I don’t know how to solve "incompatible types cannot be converted to", that stays on the line, and when I try to compile it appears like this.
Exception in thread "main" java.lang.Runtimeexception: Uncompilable source code - incompatible types: deodorant.Desoclasse cannot be converted to deodorant.Deodorant deodorant.Desodorante.main(Deodorant.java:4)"
There is no other line with error, and my object is very similar to the examples. someone can help me?
package desodorante;
public class Desodorante {
public static void main(String[] args) {
Desodorante c1 = new Desoclasse(); //essa é a linha com erro
package desodorante; //aqui a classe
public class Desoclasse {
String cor;
String perfume;
int carga;
int peso;
boolean levantado;
You may be trying to transform an object
Desodorante
in a kindDesoclasse
and these classes have nothing to do with each other?– user28595
In short:
Desodorante != Desoclasse
– user28595