mercredi 16 juin 2021

does java.util.Random return null

String.format("%04d", new Random().nextInt(10000));

This gives a four digit number as a string. Is there any chance that this returns a string "null" by any chance?

string "null" because there is String.format("%04d")

Also, will new Random().nextInt(10000) ever return a null?

I am using this in my application to store in oracle database and found that a string "null" is inserted into the respective column. This is absurd and the only possibility I could see is with String.format("%04d", new Random().nextInt(10000));




Aucun commentaire:

Enregistrer un commentaire