0

code

i've tried change the constructor

and tried do a for to replace the value like this but its not working

public Cliente(String nome, String cpf, String tel, String end, String num, String cidade, String estado) {
        if (nome == "") {
            this.nome = null;
        } else {
            this.nome = nome;
        }

        if (cpf == "") {
            this.cpf = null;
        } else {
            this.cpf = Long.valueOf(cpf.trim());
        }

        if (tel == "") {
            this.tel = null;
        } else {
            this.tel = Long.valueOf(tel.trim());
        }

        if (end == "") {
            this.end = null;
        } else {
            this.end = end;
        }

        if (num == "") {
            this.numero = null;
        } else {
            this.numero = Integer.valueOf(num.trim());
        }

        if (cidade == "") {
            this.cidade = null;
        } else {
            this.cidade = cidade;
        }

        if (estado == "") {
            this.estado = null;
        } else {
            this.estado = estado;
        }
    }

i think if i change the constructor would be works but i have no idea now.

UPDATE: i found a solution solution

0 Answers0