- 1
Fill in the blanks to define a function ''myFunc'', which throws an exception if its parameter is less than 0. void myFunc(int a
ho do work out this
17 ответов
+ 18
Ans:
void myFunc(int arg)
throws IllegalArgumentException
{ if(arg <0)
throw newIllegalArgumentException();
}
+ 12
public void do(int x)
throws IOException {
if(x<0)
{
throw new IOException();
}
}
+ 2
throws
if
0
new
0
if (a < 0) throw new IllegalArgumentExcpetion("Parameter cannot be negative");
0
public viid(int x);
throws IOException{
if(x<0)
{
throw new IOException();
}
}
0
public void do(int x){
try IOException{
if(x<0){
throws new IOException
}
}
}
0
Fill in the blanks to handle all possible exceptions.
0
Fill in the blanks to declare a method that takes one argument of type int.
public int myFunc(
x)
return x*10;
I need help
0
0
Drag and drop from the options below to create a method that throws an IOException if the parameter is negative.
Answer :-
public void do(int x)
throws IOException {
if(x<0)
{
throw new IOException();
}
}
0
public void myFunct(int arg)
throws IllegalArgumentException
{
if(arg<0)
{
throw new IllegalArgumentException();
}
}
0
answers in order:
throws
IOException
throw
new
0
throws
if
0
new
0
throws
IOException
throw
new
0
throws
if
0
new
- 1
Drag and drop from the options below to create a method that throws an IOException if the parameter is negative
ANS:public void do(int x)
throws IOException {
if(x<0)
{
throw new IOException();
}
}
- 1
public void do(int x)
throws IOException {
if(x<0)
{
throw new IOException();
}
}