- 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

29th Jan 2017, 6:15 PM
marvellous gwenzi
marvellous gwenzi - avatar
17 Answers
+ 18
Ans: void myFunc(int arg) throws IllegalArgumentException { if(arg <0) throw newIllegalArgumentException(); }
18th Mar 2017, 4:09 PM
Mahnoor Shahzad
Mahnoor Shahzad - avatar
+ 12
public void do(int x) throws IOException { if(x<0) { throw new IOException(); } }
26th Apr 2018, 12:11 PM
Nikhil Reddy
Nikhil Reddy - avatar
+ 2
throws if 0 new
8th Aug 2021, 12:45 PM
W.G.A.C.Nandasena
W.G.A.C.Nandasena - avatar
0
if (a < 0) throw new IllegalArgumentExcpetion("Parameter cannot be negative");
6th Feb 2017, 7:54 PM
Tamás Barta
Tamás Barta - avatar
0
public viid(int x); throws IOException{ if(x<0) { throw new IOException(); } }
8th Apr 2018, 8:07 PM
Aliyu Umar
0
public void do(int x){ try IOException{ if(x<0){ throws new IOException } } }
14th May 2019, 10:06 PM
lalith de silva
0
Fill in the blanks to handle all possible exceptions.
15th Jul 2019, 6:39 PM
Adwaith Prakash
Adwaith Prakash - avatar
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
16th Jan 2020, 7:34 PM
Luke Porter
Luke Porter - avatar
0
16th Feb 2020, 4:49 AM
MUTHU.R
MUTHU.R - avatar
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(); } }
30th Jun 2020, 5:36 AM
Gourav Tomar
Gourav Tomar - avatar
0
public void myFunct(int arg) throws IllegalArgumentException { if(arg<0) { throw new IllegalArgumentException(); } }
16th Oct 2020, 3:08 AM
Chorintians Lucky Panjaitan
Chorintians Lucky Panjaitan - avatar
0
answers in order: throws IOException throw new
10th Mar 2021, 6:29 PM
Rusz Tamás
Rusz Tamás - avatar
0
throws if 0 new
1st Jan 2022, 12:34 PM
M.I.M.Aqueel
M.I.M.Aqueel - avatar
0
throws IOException throw new
3rd Jul 2022, 2:56 PM
Antenhe Yimer
0
throws if 0 new
5th Jul 2022, 7:43 AM
Antenhe Yimer
- 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(); } }
9th Sep 2017, 3:01 PM
Nazmul Sarker
Nazmul Sarker - avatar
- 1
public void do(int x) throws IOException { if(x<0) { throw new IOException(); } }
28th May 2018, 8:01 AM
Mohammadalaminsiam
Mohammadalaminsiam - avatar