dimanche 17 mars 2019

Throw exceptions without using if - Java

Is there a way to throw an exception in your function without using an if statement in Java? For example, if an integer is smaller than 0, I want to throw an exception, but when checking that specific condition, I don't want to use an if(or switch) statement.

Aucun commentaire:

Enregistrer un commentaire