0
I have a Bean class (Casa.java
)
public class Casa{
//atribubutos
private String parede;
public Casa(){
}
//getters e setters
public void setParede(String parede){
this.parede = parede;
}
public String getParede(){
return parede;
}
}
I’m trying to instantiate her in another class like in the example
public class testeCasa(){
public static void main(String[] args){
String erro="";
try{
Casa casa = new Casa();
casa.setParede("Parede Sul");
System.out.println(casa.getParede());
}
}catch (Exception e{
erro = e.getMessage();
}finally{
System.out.println(erro);
}
}
Only what time I turn the debug, he arrives at the stretch Casa casa = new Casa();
" and for the program does not continue to casa.getParede();
and goes straight to finally
printing the error as "". What can be?
What error appears?
– Maniero
Maybe you need to make one
import endereco.do.pacote.Casa
. But it’s just a hunch, you have to post the mistake you’re getting.– Math
made the import, it does not appear error, the program only stops and nothing else occurs @Math
– Tiago Ferezin
If the code only does this even if you posted it, there’s no mistake, it’s not doing anything useful, that’s all. It performs well, only you didn’t have anything done that can be verified. We can’t help much with this information alone. If the code was complete, maybe help a little.
– Maniero
@mustache the code is right, the getters and setters are the same standards, it just ends the program without picking up the get or passing to the next line of the code after "House = new House()", tb to find strange this but is what is occurring
– Tiago Ferezin
You’re saying the code is this, but it says that it has getters and setters, says that there are more lines later. This does not match. By your description nothing is wrong or the question cannot show what the problem is.
– Maniero
@bigown put the whole code and what happens, it won’t even set
– Tiago Ferezin