0% found this document useful (0 votes)
6 views21 pages

Adobe Scan May 04, 2025

The document discusses various concepts related to inheritance in programming, including single, multiple, and hierarchical inheritance. It also covers accessibility levels in classes, exception handling, and the lifecycle of Java applets. Additionally, it touches on the importance of memory efficiency and the handling of critical sections in concurrent programming.

Uploaded by

soumya312005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views21 pages

Adobe Scan May 04, 2025

The document discusses various concepts related to inheritance in programming, including single, multiple, and hierarchical inheritance. It also covers accessibility levels in classes, exception handling, and the lifecycle of Java applets. Additionally, it touches on the importance of memory efficiency and the handling of critical sections in concurrent programming.

Uploaded by

soumya312005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

loterntUce,

tob erreate
y Tnbonitomce,: Inhomitenceis the meshgd
frorm oter
cosses

Dsws diferem tre of nheitonte in Jove .


imhemance :
’>
One gubebs imhemit Phomn me 3upemcbr,

2. Mutlove Inhenitce;
’A ebs s demired mom o closs sbich is alrody
demived roon onothem eloes
3. Hieromchical Tmhomitonce
Muliple classes imhemit fom o
’Mlkpde SUpencb
ne method ovenmidmg.
Mothod overmiding ocens hen obolass (ek.dcbu)
hus the gome meod as he coment ebes.

Gylme:
cloe Amimad f
void oumd )
Sgstem-out. pmntn( Prnral. mokes a

elos Dgg, exferde Amimal f


woid goumde)

closs Test
Amimal Mew
obj. ound (
Hleme
the somd)sme hod of
fmimal. whem called, the
He overmilen metkodn
is execoted.

direnen lowele
acces
1. Qmivote
i-Acesoble
"not misibleom
on ttin the some class
to dher class
rninete nt doto
· Accessobde wthin Hhe
" Not gbe package omb.
ot eide the patoge
date
3. ponotected!
feces be wthim me qa oge
Subelocest n cthe annd al80 by
pmotected tmt dotopackage
4. pobhe!
fecessnle krosr ogjahene
ey
OeresJ.
publre ind cu
bluepmint fon ocott
thot
okdratin
> fon inte ramd motpt imhemitnce.

void gocndt; t abstnac


mha
erplon

void ehoo ()

meid dsplbgr cO;

oobic. woid shot)


yaten. ou. pmindnl
poble void
stem.od.
3
Clos Test
Masm
Erdoron
-Irtereee
"Clos Aamd B both
"Th
c
implement hore obtrod melast
h mteroces
tigy, clo Cgeb tne.
Ohiexig, muliple rhermitonteotres
e. of boh onB -
8) Discurs difrert
>Contoins pocage
System et. cone cloeges ike
3miag, Math, dboet,
> Imelvdes
pote, col utilitr coces 've
letions, eto. Amoyl,toh My
prorvideg elogseg
Itke Fle, od outt
4) ora,net Inutstme m, utp
Stmesm .etc..
> Suppontt neton
UPL Connechiom,et ing etures Aike soret, öR L,
5) Joa. gal
>ised tom dotobase
like Comechiom ysatemed, classes
Rlesolhse, etc.
Bupponb GaUI deroopgnent. Iomcsles Iike
lixe Fro Me.
me
Botton, Lobel, et.

Adromced GUI lomtaimy elasses |ke


Jfrome, JButon, JPanel,ete.
defire porxg
Sheo 1:
Step Oreate o poerage
Use the poccgge kerjwomd at he top of Joom
OUm Jora
fle.
potage oo

SysBen. oud.primtl (lo Prm My cor: )

Bove the Gle mide olem. oith the some


03 Hhe poetgg
name : poek
rame AB.Jovo

SBep3: Corn piBe the le


tio h tomnomd to compi le ond kecp the poekage
Shmuctee:
> Jovac -d.AB.java.
Step 4i use. the poevage tn onothen eloe
’ Jmpen the pocKoge ard Use 1 clasg:

impont pock.. A8
publrc elass Test
publc

AB oby mew AB(O)


dby. doplory ()

Kteps! Compile amd an


Sonroe est. Jao
Jore Test
ne

rpg Muitimedig
molhple. trends Malifoting.
the Bome tiane.
"TRrneod
Thme tmahes molti ple.
HrenTmno lyes molkple
poroceeseg
Shorgmemoy omtes ses hanre
EfeieryMome effictecn mema
Uges less es
geporae

memony effient
operohg Syskem
roblemm bourdea
mdblemboumdea rg brroele
proorerr consumrer
>pmodue er ( oreurn er corololorn
roblon ehone.
hone o coron otfer
ed ize, The orodocer puh en feryrot icn in
A.a tte text st ot. hocble
con ornres a
tao timet. First ohen the rodoren orte to
in onnation ito the boftern and Hhe boffe
fhe.
out trom empty buffer. h
rter procees
ohved UsTmg tnmee atani gemophone vonroble os

if sraphore. vyniable cohie


of elot ane kolh I

} s a semaphore vor ioble eoumis he unben of


amt
omber of slot.
huto- Birorry semophoe ensume hot oh prodce
tom3u mer tont fccess he butfen ot he ume
mutual
Whet
he
pragrm Jherne the
red
miticl memory
gecftom oceted aled. He
atadrom to Hhe
Hhe mtal eectiom problen r
1) metl nee
onocess
roresSS Com secbtom them
lection ere cofien ohen

eritieal gection
b ertesn 80me
Hhain citiced procesr e
Hhose proeg3es sechions,
Hrat ome en
emenden Bet
eoniieal detid ggchrh
ciom
Comt sectiom
oe. ment md ho
definenty progpomed
of kimes that Heyame
her proeegres one
mumden
after o process (niiederh'o
mode
hal 3ec tora
gnamhed amd before
cbs

pmiomity
>.Tred. MIN_PRTORITY 1 (lboes)
Thnend. ORM_PRTORT11Y 5 (detout )
. Tread. MAX- PRIOPJ T7-
10 (highent)
Treod Ti heo Thneod C) ;
T.sctprigmstbl Tareod, MAr. PRTORITY)}
5) Eraton Hbrdbigi
Eveton Mordlina
(erntine errrngso thot the prggrom com eonten ve
its nogrol Aoco ooihoced crashing.
Steps Eceghom Hordlingg Metontms :

Ploce hetode thod raoth might trous


om oxcertiom
eX

2.Catl BlorN.: CoBches ond hondling he


erecphiom
Ibon dling code
Exeroe code hoakon
boheoherr o omot om orrertiom
exceptiom Oc n

Ileleomup code

ThroThmoos
0sed to erpli cithy
tno om erceph'onlthr)
thao ned
void metho d)Exception ("Frrom )
thnows 10E ceptiom
tbw mory eafch thexs
blecs? fny

7 We com ye muliple each blocKI cih


try blaxs. Thu alloeas us to homdle afRemed
Jpes of exceptions eparo b.
Eoch catoh boce dhould codeh Jitfreont exepon
foype, omd gavo enecki them monder Prom an
to botom.
o1
yoU can have many cotch blocks 0s nede.
Mone soecife erce phons most Come betone
omes ((ixe
hve Exeeption). gereral
Pond, othen! ame
Skped.
Eromple :
pobli closs cotch
public stat woid mam trimg rgi
ony
jnt a0/0)
cach (amitnmehe Exeeptin e)
ystem. out. prmbn'Apihmeh Sceoh o
Coteh (Prrander Oet of Bonds Ereepthion e)
Syalen eul.pr intm(rnay mder out of bourds );
Catch (Exceprion e)
System oak pminthnlaenernal Exepton )
Amihmeie Ercepion
Jma. applet.Applet
metrod, Imtend,tomd doeg mot hoN amamy

foclioction omagroam
EreutomAms im
on standalone
JVM
Dees rot U3e moimc)
tmethod
mnainy
metto
tonte raeton
0m Console
Life Cyle Useg tmite), stormtJ,o
Shop) special fe cyele
methods
The

aled orte iherr he oper is ingd loa oed.


2. 3ha1
talled orrer initt) ord enery hime the opelet

sr treod. nesome toers Iye ammation


3.Paimt Grachics )
(alled orter r) h
sroto the opples outeut
arophicz onnd viSual outet
4.3rcp
alled ohen he oppet is not wi 3ible on
Úeed to su8pend actiwiieg Iike
ominoh
ornirarion. Hhonade n
5.

" Called biten the applef nemoved from


crnernomy.
berng
Used to ceom ob reoomceg omd pent orm fiwal
tok
Muliple toghentonce.
Jova does
d not
9uppor dinet molsle tnhenitan
implement mamy
hekar ien ony. of moltple. inheriomce betn
i m p l e r e y

Llos hone con crete pmiromib, obstrot


metod methods (mo inemerbhion
Sote Con hore metonce vomidbie| Grenefrolh
NOrbles
rieriorce igle ihontonte
Moliple henitence of
Srstthion|Ocet o be crected
Com' dinecty create
Crehructor|7yeicaly os (omshrucon Cogent
porpose No Comstruc tons
drgects Coontract
G)

boreye Fscty ore


orce en ekpresionFoch
eraluated
matced brgnch
gainst Coce labels. dllerent Boodeom condition
coR3ibb ne ehecrig
the Some
Albwed Disemegte, eompiletme rolue mng lam
at vtsed Coms tont amly. Any Booleam eApsne
-nelotiomal erprersom
DhatOptial deoet: lobel OPima finad
hordlacatt hes omy ommathed else bloox
catchee Ommete
NaUe. hed conditony
Jova iso momed boldem_J.
thot: elasses

Gives
Ono id each Caes a (gue
(riq mome sace to
nome
R. Lot
Je clashes. reloted
teogrmates Keep mested code
one etult- tagten
-acc e39 m em be an
yhot is soatic ion pomt,?
1. Alsoa gyeo to ocess sto menbens (freld e!
omehiodi) of o clol' toilod qoolityg e
Class momme eoeh bine.

inpon Staic poekge


.cloeome.

import Skatic gpno.long. Math.* ;

Dore thned
imdependen path of
erecotion withn a progroern an caJeet
dhyer o f
thot he JVM schedu les, sham ing
he pooest' pmoee'
pnoLesr'ss heap bot holding ib om
call ac k and

mally block, i's tied toto erecute impo ntamt


Such os clos ing cole
e3ooDCeJ
excephiom gordless of ohaho
It domys executes ot
ter aey y bockJ
Catch blocy ond
mport gowa.oh.

pubie Cles son

st - 3C.nexrtLine );
System. out. pmnt ('Ernter stotig
innt sto Se. herJt() mdex:"
iont emd (. next Imtt);
entmocted shm. sobtonima (Strond,end)
Saem.out.prmm Erofed g:ertt

otpeti
Eorter a
Ender shetng rder: 1
Emter endig ierdex:7
Extracted hing
Studend (Shming mome)
oetem.oyt. po intn ('Nome. mame)

Sheslent(Strig rome
oge)
gstem.oot. priotn ('tame*n igera)
puble stalre goid moim (Iimg1
og)
31= heo Btod ernt C);
Student
Stodent 33
hrapge coss

prodes he meckomtm to
phrugperr Clogs
i
on einto oget ood chyet imto mirlhve.
"Addeoring, ard ondorigg, tostunes comvert primihe
riomh
into ogt ard obrt to ormithe ouem dhi
) The eignt clocers of he ra.
krem as omapperr classes . lorg poehage ne

(re

G.vomitive hpe wrapperm Clar


1.

2. boean Booleam
3. ehor ehamactem
4. double Double
Floa
6. j'ont
7.

3Bho log

You might also like