Method does not accept passing of null to the parameter

3

I have the following method:

public String insereRegistro(int tipo, String data, String horario, String historico,
                                  int veiculo, double km, int cliente, int solicitante,
                                  String finalizado) {
   ...
}

How do I get the method to accept the null value?

    
asked by anonymous 26.01.2018 / 16:14

1 answer

4

You can pass null on all parameters other than primitive types.

If you want to do the same for parameters of the primitive type replace them with the respective classes:

public String insereRegistro(Integer tipo, String data, String horario, String historico,
                             Integer veiculo, Double km, Integer cliente, Integer solicitante,
                             String finalizado) {
   ...
}
    
26.01.2018 / 16:19