Oope 9 Obien:: Main)
Oope 9 Obien:: Main)
stutent Si-new
stodent ) 1/Coealtngon
okjec of shuden
Syeem. oulprintIn (st.id)
Syslem.oul Prinln (s1 name)
int age e 30
s l i branchcse
Syslem Oul poinlin"yoor 0ge is: "+age)
fnd Sala7y+00
Ezlends B:ke
closs+Honda +
void runC)
Fublic stalie
votd ma?n(stzingtig)
Hondal+);
Bke obj neu
Ob.oun C)
Output JavacHondajava
Jova Honda
unning sately
Toogram o n encapsolation
Package mypack
Poblie class simple
Class Vehicle
votd sunC)
void onc)
VOrioble naMe
a P 7 0 9 r a m ,
where z 1s
nt z =
1O 1/
Ex
on
i s nlertace?
wpile a program
bwhot
indexface? of methods, which
is a collec-ion
AIntesface;-1
and
abstoact by de faut
ape poblie
Proqramr
inlesfoce calinteoface
7etom atb
Detusn - b j
Sob pockoe
Ypes of Facka
BuH-in pockage
Uses defncd puckage
user defied pockoge
Steps fos Csockrg
. 3sst czeate a disectoy within narne a
Fock0e
2.Cseale a java :le in neuy Crealed d:redor
am.
whot an tzepton ezplain pe af
Ezceplion
Azcep ton hand ing is one o? 4he pxwef
handle t h e runtime eorors So
mechanism t o
he oPplicotion Can be
nomal floco of
hat
ma'ntained.
hese Excepkons.
Unchecked
n
aceptionExceplioni-An
that
occ unchected
hese a e also called at the 4ime exceptions
at eeatin
a s kKuntime
mclude T dmmina buS, Such os
Exception, these
impopes Use o}
logte essos so
Ap1. Von-time xceplions av
gnore d a the fime ol Ezceplians
comp:lalion.
00SThese ase not ereeplions at all, but
Poobems thal 0sise beyend -lhe corsol of 4he
User OD the ooa6amme Eoso defnes
Pooblens thal oe not
Ezcepled ba POamm