Professional Documents
Culture Documents
Practend o o
Packagc (Ctecution)
Tova Pograrn execution of Packo
bwvite o
Oim
lgo tho
he Java Code
Compile
Step
he .h file.
coea
Step
Native method implernentation
y Wite he
Step
Shared JibNOny.
Cre
Create
SteP
Program*
import Pfist
ctass Second
adisplay c)
Outpuut
first Package
ADITYA DEGREE GOLLEGE
Dte ( 3 33
Exception Handling
Aim Ovite a Java PYogram Ho dernonstvote xception
Handlin9
lgovl4hm
Stort
Step
equived System
defined
PackageS
import
Step Co
C on
nttaa
iOi nS
s
tohich
ExceptionDemO
aclass
C v e a t e
3
Step method
main
Scanner class
an
Object for
Cveote
SteP n.i,d
5, 0,i,d
Size 5,
a
aYr oith
oHh Size
Delare
an aYYay
5
SteP
Cveate aty block
6 of elementS into
Step
Reod nValue number
step
orYau.
Oh zero and epeat Step-9
Initialize
8
Step until i20
into ar Ci3
element
d an
a
denominatoYintod
ead
Step
DEPARTMENT OF COMPUTER S
ADITYA DEGREE COLLEGE
Pratieal o 69
blbCk o Catch
a Catch
Cveate
13
Step AYayTndexOut of BoundSEXception.
Catch
catch
a Catch block+o
Cveate
Stop.
15
Step
ADITYA DEGREE COLLEGE
Pratel o
ogvom
impovt Java.io.
impoYt Java.lang *
*
impoYt Java util
class ExceptionDeno
int i d y
try
CHouo many numbers ou ant:)5
System.Out, PrintlO
n-S.nextInt C)>
Entey Elements : ),
System.out. Printin
for Ci-0 ieny it +)
avY Ci S.nextLnt C)
3
C Enter denorninatoy:
/System.out.Printio
aS.nextTntC)
DEPARTMENT OF COMPUTER SC
ADITYA DEGREE COLLEGE
Exception e)
Cotch(protrdeioutpfBourds
Ranoe
Sysien out.Printin CBrray
out
Exception e)
Catch (Prhmetic
zerO ETTOY
Divided by
Sustem-Dut PrintinC
outPut
numbers you ont 3
Ho ran
mony
10 20 30
Enter element
denominator5
Enter
DNISION IS
to
2015
30/5 6