Je pense que Si ma méthode peut lancer plusieurs exceptions, comment le déclarer? p> jette une exception code> ne traite que le cas général. P>
3 Réponses :
public writeThisToFile(String line) throws FileNotFoundException, AppSpecificServiceException, SecurityException{ /* some thing */ } See Also § 8.4.6 Method Throws
Utilisation de la clause code> code>:
public void yourMethod() throws anException, anotherException { //stuff here }
Quel est le problème avec la virgule? Lecture ultérieure