I would like to call a method with a parameter being an object of another class, but is this object created in an earlier method?
Example:
Class A:
Public void cadastrar (Cliente cliente){
System.out.println (cliente.getNome());
}
ClassB:
Public void metodoDois (){
Cliente cliente = new Cliente();
}
ClasseA chamada = new classeA();
Chamada.cadastrar(cliente);