- 2
java
Drag and drop from the options below to create a method that throws an IOException if the parameter is negative. public void do(int x) { if(x<0) { IOException(); } } throws IOException try new catch throw
2 Réponses
+ 1
It is a quiz question from the course.
public void do(int x)
throws IOException {
if(x<0)
{
throw new IOException();
}
}
0
IllegalArgumentException is beter here