TU 2019 $3 CS JAVA M4
Brent _Hondliog
Event Mane”
~£vens Handling 3 the mechanism Shab Contr,
tne event and! decides ceohab shoclad happen
(fae VEN occurs < BB )5° paechanism Pave
the Cod@ cohich 8 kiown as event facdler
Grote & execttled When an event octns »
4 oe
Javea cises belagauen Evang O0del 6o hands
bhe. events...
Somers
- Delegation Even, = folfocor:
a ¢ Noeole! 2g
key Partiatpants po chonge (27
he ete 818 ee es pab JESU O, wa Seesven >
SOU Y Eye B10g A CAHN yeosae OCCT
o Source 5 - fs an Obj ech On Coni® SY ee
a:
I & respenBible for proud pafor cote
of the occured even 60 «s fard ler *
event Sores are
: dpe
Betton + - generate actor events Per
bertion 1s pressed *
eols COPeD +e.
Check 026 $- GePETHE tere ave
facte
: Speck por ts Je lected O” cezelacted
choice s- gene aie tam Nenés Corea chace
is charged
Lis6t- genetae evens cOnen Hero &
olouble aftered
aevalea event Cobar A earalecd
coindocwdi- gen
gals.
15 closed », opened OF
& Ligtene’ 3-13 also (er0en a3 ever farclles
5b is vregoonsbe. for generating vEGponse es oa ee
Aisjener coatts Got! bretwes an event. 000
the evené is recowed, the listener proers2
the event & dren %elerna~ Lesjenar 1e2ats
to be. yegretered LW =x
a oer
Iatoner or rect 1s Sraey ASEeven
°
REGS Pig ~
event soure veg potercd eve fastener
Ssoure genercdae event 4 set
leped Cott be BOCA» COP 2
dhe listers? » APEG PIow oF Sie evade
yetun-
general ferro Of Ee
vorel actd Type 41s120e7
Type-nanma of event
Hs
oteration
CO Tey PAKIBVICT el)‘TU 2019 $3 CS JAVA M4
Using the Delegation Event Macle|
Hanalliag Mouse Sverks .
droport Jove ¢ adh =;
lreporé Nava. Geog. evené:#)
Tnopork _jove. opples-ns
rb
PB os la2s pouse Events external ' Applet
; hop lerseats Mouse Arolenct : Necuce ealhtiatsiol
Shing rag.2\ us
196 roausex =o, ‘neousey =O.
peble vord whe c2
acld Mouse kisteset: Cth |
- addMouse NokKonkistenet CHI),
porblie.vote! moeuse Clicked (Mouse Evert 2)
ragqg =" nese entered” :
Veparnbed: S
te
7 7
Z “pncuse k 20> toe
mousey 210! ae
ogg = rego eoctlect” 5
yepata:
3 - ee
public vot 2132 Praseed C Meuse kent e)
i
s moose K = Bh GebXO>
rouse ¥ =e, bY OL
radg = * poten!
wepanbed ; ‘= <0 »!
19 §3 Cs JAVA M4
Perbha
Vo
i moc Released ( Mouse BVeNE ©)
Mouse x me. getxcy:
eh ae ee
meg! = me: 9ebYLI;
F = Nee, 2
‘Perea. 7. 7. : An
t Mole? rocece Pragged Creouse Evert 2)
Mmersex = 2. gebXe2:
Mou.
FEY = 2 getyer:
(OSG = = %
3 reaperinbiy, _
Pebie vee reside Moved Cnipizezvent a)
oes C10 rouse som Pe umes “peer op
2-3 . - 2 = waar Ge
[Ppeebha vow pene Comepnes Dv
ge reuings C Coreg 7 ’ ewes % raousev);
3TU 2019 §3 CS JAVA M4
Herclhag keyboore/ events
trypporh lava. acd #3
tmpor’ Java. acu events.
(ropore Java. apples. #
plete
Pebhe class aroplebeg eacteras A
Mag heer
g
o
troplercente
Sénng 9g 2";
Ine Xl p= 8D
public. votel w/e C2
iz
adla kay A0sdanet CHAD,
3 :
Perblic vow eyPressedCKegevext ©. 5
é heey Fates C a ieag etocon D2” i
pecolee vod peg Released Ckegbvert 2)
Z shaw Stokes C8 kay ep D2 are :
perblic vot wcagTyped Cleay Evere eer
g roagt = e° giilhay Chor Os
yepaungeI)
J
ae veel pat
eecsing (7086 * Di
Covaphes 2
& gict
3: 0800CST205122002
Reg No. Name:
APJ ABDUL KALAM TECHNOLOGICAL i
Third Semester B.Tech Degree Examination Decembe
Course Code: CST205
Course Name: OBJECT ORIENTED PROGRAMMING US}
> Max. Marks: 100
PARTA
Answer all questions. Each question carries 3 marks Mark
“1 What is Just-In-Time compiler? @
2 Why Java is said to be a secure programming language? G)
3 Does Java support multiple inheritance? Justify your answer. @)
4 Why is the ‘main’ method in Java qualified as public, static, and void? @)
5 Explain any three Byte Stream classes in Java. @)
© — What are Checked Exceptions? Give an example. @)
7 List any six Event Listener interfaces. @)
8 Explain any three special string operations in Java @)
9 Summarize any three features of Swing API. @)
10 Differentiate between Components and Containers in Swing. @
PARTB
Answer any one full question from each module. Each question carries 14 marks
Module 1
11 a) Explain Lexical issues in Java with examples, ©
5 b) Differentiate between function oriented and object orientedsofware design
approaches using a suitable example. @)
12 4) Construct a UML Class diagram for Online Movie Ticket Booking System. The (8)
various entities involved in the system are Admin, Registered User, Visitor /
Guest User, Movie, Book Ticket, Make Payment.- 16
18
19
20
information. Import.this package in another class ang use w emer =~
even or not.
b) Differentiate between try
a) Write a Java program that reads a binaryfile and write
1) Write Java code that reads @ character file and prints the o
display, with a line number before each line.
Module 4
am to find the duplicate characters in a string.
synchronized keyword in Java? Explain with examples.
a) Write a Java program that creates three threads. First thread generates 2 random
positive number (>1) every 1 second. If the number is even, the second thread
prints all even numbers between | an er. If the number is
odd, the third thread will print all odd numb d the generated
number.
b) Differentiate
catch, throw and throws keywords.
to another file.
ontents of file on the
a) Write a Java progr
b) What are the uses o
.d the generated numb:
ers between 1 ant
between Collection Interface and Collections Class.
Module 5
2) How do you establish connection between a J
Explain the steps with sample code.
b) Write java code to demonstrate the execution of sel
DBC
2) How events are handled in java Swing?
b) Write a Java program using Swing to crea
threelabels and a button. The interface has to accept & number in the first text
eld, While clicking the button, the second and third textfields have to display
the previous number and next number respectively, of the accepted input
number,
fava program and database?
ect and delete queries using
te a frame having three text fields,
(6)
(8)
(©)
(8)
(6)
10)
4
(10)
@)
@)
(10)9g00cst205122104
D
Name:
Reg No.:
APJ ABDUL KALAM TECHNOLO!
ary
‘Third Semester B.Tech Degree Regular and ‘Supplements
Baunune
Course Code: CST205
: Course Name: OBJECT ORIENTED PROGRAMMING USING ee a,
‘Max. Marks: 100 ARTA
“Answer all questions. Each question carries 3 marks Marks
How is platform independence achieved in Java? 8)
Explain how garbage collection is done in Java. 8
Explain the use of static variable with the help of an example. @
Can final modifier be used with an abstract class. Justify your answer. @)
ifferentiate between the usage of keywords throw and throws. @)
Explain the significance of CLASSPATH environment variable in Java. )
List any three event sources and their corresponding event types and listeners (3)
used.
IMlustrate the creation of arraylist with the help of a sample program. @
Compare Swing API and AWT API. @)
‘What are layout managers? List any twolayout managers. @)
PARTB
“Answer any one full question from each module. Each question carries 14 marks
Module 1
uw
a Consider the problem of a Service Station which provides three types of (10)
services to its customers: refuelling, vehicle maintenance and parking.
customer ean pay using cash, card oF cliéque. The pricing for vehicle16
17
18
Create a user defined exception ‘InvalidAgeException’. Write a Java program (7)
that takes age as a Command Line Argument. Raise the Exception
‘InvalidAgeException’ if age is less than 18.
Explain the concept of Serialization and demonstrate how an object can be (7)
serialized with a sample program.
Module 4
Illustrate the event handling mechanisin in Java using the Delegation Event (8)
Model with the help of a diagram.
Illustrate the usage of the following methods related to String with appropriate (6)
sample code.
(i) findQ —(ii)substringQ (iii) replaceQ)
What is multithreading? Write a multithreaded Java program that (7)
demonstrates the working of wait() and notify() methods.
Page 2of 319 S3 CS JAVA M4
b
0800CST205122101
”
Explain how ActionEvent class and FoousEvent class is used with emphasis
on the methods and constants provided by the given classes.
Module 5
at uses two textfields and a button. The first textfield (9)
Write a Java program th:
“Convert” button is clicked the
accepts temperature in Celsius. When the
second textfield displays the temperature in Fahrenheit. Use appropriate
Swing components and event handling techniques. F=(C*9/5)+32
Describe the two different ways to create frames using Swing package with (5)
appropriate examples.
Discuss the Model View Controller (MVC) Architecture using a diagram.
== hasad an MVC Architecture.
”Course Code: CST205
Course Name: OBJECT ORIENTED PROGRAMMING USING JAVA
Max. Marks: 100 Duration: 3 Hours
PARTA
Answer all questions, Each question carries 3 marks Marks
1 Discuss the concept of classes and objects in Java language using an example of (3)
a ‘student’ object in a Student management application.
2 What are the advantages of using UML? Sketch the UML class diagram for an @)
entity ‘book’.
3 List out any three literal types in Java Give examples for each. @G)
4 Differentiate between Arrays and Vector class in Java. @)
5 How do you create and import a package in Java? @)
6 — Write an example of implementing an interface in Java, @)
7 Illustrate the working of any two methods of String class that compare strings. (3)
8 List and explaif any three methods defined by the ‘List’ interface in Java. @)
PF 9 Point out the use of a Swing Layout Manager. Explain any one type. GB)
> 10 Compare any three types of Swing button classes . @)
PARTB :
: Answer any one full question from cA module Each question carries 14 marks
11) Bring out the difference between function oriented software design approach (4)
and object oriented software design approach using the example of an20
. Module 4
a) Discuss the event handling mechanism in Java using the Delegation Event
Model?
b) How mouse events are handled in Java? Give suitable Java source code.
a) Discuss the methods of creating threads in Java using appropriate examples
b) Write a Java program that creates multiple child threads to print odd and even
numbers from 50-100.
Module 5
a) What is use of Swing package in java? Discuss any two features.
b) Write a program to illustrate the use of JFrume, JTextField and JLabel.
a) Write sample code to establish database connectivity in Java. Discuss the
various steps involved.
b) Write Java code to demonstrate the execution of create and insert queries
using JDBC.
6)
(8)
(0)
(6)
*@)
(10)
@)«TU 2019 $3 CS JAVA M4
pevect clo srns
Ackonkvens Claas
Actwonkvent & gererete
or feero ob a lise 13 doodle che.
M6 cdletines 4 mlegee on dtane
ALT 28Sk » GIRLZ top 3E y W267 —
at coren petloR CURA
feed
popsk, BAIET CORK
Geb Action Coramand CP -— veturng 722 corem aad
coWb tals AHOO
yeti a Valea phat (adtaes
ey? wera PrezseD 1
pic evens
doo: DIAG
Béria, assoctatadt
ges racal fiers co? -
topcen raodities ©
gee When ©? return Erne aé co.
Keygvent caés
ker Event (2 ge
occur2- 3 wnteger
bey rypE2
geekeychar cy _ vetara tee characte? associated
Co Hb GY 12 tee even
getkey Cockec> _ yet leey Coole
poy board wpe
neradeda Coren
Keg REMAED
constant? IEE Y ~PREZIE® ¢—————
K
TU 2019 53 CS JAVA M4
Focee
ete! class
ReesEveng ae
Geos — o georsraled ren
iS % 203 papel focds*
CEnslanis :
St fecus-nAine? } one
92b Oppos162 Conponent C2 — veten® OPE Sra poner
cpan,
'sTeroporanges veterans 1708 “ Lon Spores
aR Ones
pocus 4037
Mpese Event class . .
This event ircleates a poos2 F hom ier?
(2 a ceropenedt ,
lQlegea coastants
MoUs KICKED, [QOOPE — penneE? ¢
Movge _ Enreean, c90v5E- ERITEP + PROOBE= PIMP
Movse. pressed, pose RE LERIEP
GCEXCI- veturas ere X= COTO AEP OF recuse
coubin fee. corn pone et
GebY CI — veteins Y= Eoorclinate :
getPort 62 ~ obtain’ tba ‘coord aa ee OL VS.
peowse
gee Clrcle Gountlo— 20 Of mouse Clicks
| gebBattonc? — retarn 2 volun tiok ve prose”
the bation +hoé Cacsee evox
tordowd Evens Class.
Correlon. Event (9 grerelat Coten corrclocd (5
actwated, ‘closed or opened
Conslar5.’ WINDOW “CLOSE , INDO OPENED,
corwiaDe) -— ACTIVATED, Coroow— 4037. Focus. ote.
geseInctecat? = Yelan toxndocd Object {hat generale?
gesold state C7. Get Neaastatecy — the event
current ee eee previous 4[ES
U 20
19 $3 Cg JAVA M4
Zven
6 Aistener wler,
—____. AAS
Acto,
er lola ¥ fag
Ota vs
aCkon Performed Cc. ton Zve0t ee) |
Pocaskhishenes (ler: on
Oo
vord 5 ~
ace focas Gained Cfocus Everé ted
_ Reeasiosé C Focus vere fe) ;
Kegkistener wlereo
SS
a keg Dressed Cheysvent: ke)
old keys leased C keyhrent ke):
Vol LeyFyper Cray svent ke)
Moose festener (oterf2e :
Vor. rmowe Clieked C Mouse. vent me)
Void soodse Enferod (Ricwse Sve(t re?
Vota poise Exibed C008 38 EV CME me)
vod mouse Pressed CIQOUIe Bree me)
Vota mouse Galeased CMe use BVeNE me,
(Cnet (1OWAG:-*
Mouse paobron AIF
coe trea
vot mease Dragged C1? use Evert ne)
ye acd ee ate 2
Treat Alatenet lolevlae
vod bert Chanrged © Fexkevent 2)
bowrclew Lislenrer (Hera
— :
vod eirdow Actiatet, Cagindonivent waa)
vowt cinco closed ClaindeeEvent ce)
yar guindow Peney C btadow rent aza
: >
TU 2019 S83 Cs JAVA M4
Beneg
fs a
Pek
CE
Characte x5 . dhab represent
eating a ot
Cs.
I ce
HAG Rec fee, govord
a String 3 = ped orig G
a seqenen OF
pale D2
. sting éeral
Sbéring ot bello":
tng OG
5 wlenghec oe.
cftee
+ character ER0° *
3 3e cer
charAbl ine pocks) 40 eoctrad orge chara
1g. cher. Oi ib ;
2 parade?
- &
eeChars C2 - 4° Ccefrack reer? fpan Ce 4
getChar Ciné 3b076 (26 end » CPET sparge Ir rat 127F"
ae gee ehert Choe.eDs * oF
store? chotaders 12 a & armey
Ce 7 pers 12 A AHOF
Char ArrQqeo fo converé al eae" ™ 2
— oRrject 660 cperacter F7EF:
og: Cher erase" do Havana ge?
: bello
«brn Cerepanso TO.
< equals (g nore Bae 0) ba. corepere vale ¢
: qe striag
equalsc?
HIG ote" hello” >
BENG S 2 = HELLO" -
Sraqeals C322 false”
St. aquals ge a2 C92 DD free
egSe
2019 $3 CS JAVA M4
po Valeces
= cperab? + compare 1efevere? :
| Snag 3t =" Hello.
SHrig $2 =" Hello" s
Sl==S2 Are? >.
Core pore Toc) compare : alee?
Sl==s2 0 © a) >
S752 ave vales
Sl<52 ve valew
J: 31+ coropereTo Coz) 2
WwoclexOfe> _ searchas for 12e
OQ characted oF SLBA,
tnctece Of Czher oD _ trctet OF Ceba? A, tab otare®
° inclexc ofl, Sung 6D., wacteza Of (hig F 1 stort)
lastIntex OFC) — searenes for fae last occirene F
- @ choracdtern OF ab3/Y
occavaca OF
seule OrE"e'D; 61 7: " Belte
$+ lest IncuxOfC' I) 3 “
+ foodlirfsneg 1724
replaceco : replaa al’ octt: oe ss
Conk another chareckey
@g 3. replace ('I’, wo):
Concat tl !- Combines 2 HAvegs hello cao!
CGt BD T+ Conca C" coorfa?):
_SUb510G CD - extrac @ sebshing,
S+ sebst my Co; 2) alle
Enroe? ~ leaairg eno aves cohlespaas 7ern0vedU 2019 $3 CS JAVA M4 :
Daba Conver
— ee ee
Conven&
06 olfferens tqpeas of valeas 12to HINg
SJ: pleca f= Oo
Sagas string. valesOr CO:
Jb. repre s ene :
3 rowasle ¢ corctcable chara
segenac: — a cre,
2g. SW reg Better Wb = Reed Hog BctlerC'telb))
Sh-charAECD | e
- - Ib: length C a a
36+ reverse oeH
Hn0g -
: (brig Beeler
* Snag class TF 96 ts recetAel@
tmracelable
+ ts Slow, ane eG Cet EIT
Corsa nee" pa ore * = + Faso mermry...,
mercy coe? we
Concatenata Jeo mer
org
whengy? Of foe HAAG serge of vie anggeeeln
object wstizced aan 62 1A Creased
oa uses wG “Ge Csi Je cases Aap reers074
findlt2 — 10 Pead Pee new sudseeeane ot the
Input sequna teal Send boxe patleradeere ae cree aera reer
U 2019 $3 Cg JaVA M4
Collection Frame coork
eh fie:
‘ ection ie group of cased!
Oo i pares cork. frat
Provides ap archifackaea fo olie art marpulde
the group of okjedks-
Nets, aa
~ Colle. con frame cook ctefine several
WH eafaas ‘ .
Collection — enable .fo cork cou Group of oye
A. - eochants Eollecten fotacitle Jaqesnt:
y Of ~ extlenas Colleton -Jo Ranl(2 22!
Confeeneng cenuges elewen
Soriet5e¢ — eters sete Recatle Sot 7e «
_Collecteon joteolaw met OS
EC
(21ixhow -Csliacjion
£7. Specthas Supa
“MS CSlobledts Prat collecteo
way GM Rite
te rpethocts
. bosleen aotd C okjectob).. God ob © “Bioeng
Collector € ‘rater pred
‘E66 actotecl
boblean Po Ceolechon OD: ~ adel all Aements
Cf cre tnvoking Colladeo
Vola: clearcd . Temove all elements hora
‘probing - Cllectoo
bebban conletns (Ogpc oRID vetenn Jrus Ob!
(3. an element of Invokiag colle
boblean Comins All Collection o) x efeata trea tf mvoreing
edllecttor Contan? Gil elemems |e.
eeKTU 2019 $3 CS JAVA M4
WV,
Pee fash © fer GF hg)
7 ten Hee 7
ob) AP Stea/
b
eStéan eapuals Cobjed 08) é
5 colle HO? ¢ i)
“E collehO? '5 ergy
yn 18
- i, ern oe
x
hoflean 13 £mptyco
eo
oO- yaleare
(NE G22
List loletee : pecker ppt Fre
25
Ie decree Be ka veer A oe jain Her
oe tf plicete
OP elerees.
a seqewne ot el]
2 NQSEVE Obj
metro 2 bs,
yo! actel Lie (002% * o ene
ie rong We
pact + c fon a -1psedk
fe st ad Me 12x
boblean aaa C'
all elersa 0/P Coe AiG
gee ont poclee) -
oer
at HB opel?
gj OAD* velar?
yo Wee Hae
17e pndexzeor Coge
ist
6 1ncle2)
ab post
DQ return wmclaxe of
ead rere C0
ftorn, ae
O88}
We balla Of Coksyed ok]
| last (rane of ob]
) Liotlterater hisblterator C2 repre? an (@erahy
fo tee start of fee lHU 2019 $3 Cg JAVA M4
Collections class
Araghist class. _ array stal wae vanable (Age es
Je supports Aynamic anreg pbat COP
G70 22 neeolect-
ZO
Arreghists cre created coh ? waitcal 3:
ben bbs size (5 excoected Jee oleae
oa
& actlormatceally enlarged « copen C2feor? a
Yerooved y fae erred aan be ahrerak -
Gs Iraporé Java. ciétle *:
Class Al preyhioe Dero
z .
ID
peible ‘alahe vow! (7a COG FF
z
Anagkist “eshing > al = nee A rV@GtB CMPD
al-ankdC"e), :
al.add Cra,
al.aad C122:
al. remove C’ BD:
3 =
3
[Actes o!0. Ccollectcon yla fterate’
Mesbods cletroad Cf leraloY
Te :
co. vetara rea Uf FAVE TR
bostaan fooNext
more elements -
Ohnyjecd Rexel re ten nescy element
Yoru yemovel) - Yerrove current efement
roeipods delined @ Kiséléeratoy
Voto! acd CE obi) 197206 O%} (réo Ihe hotKRLU
2019 $3 Cg raha
b0 St
an a5 Wexte YRETE a,
rejare. free A 7
Se
bose elernent ‘
an Le
be2Prenouse. - rake VE. & Seer “is,
soe previous aera
TS : lemenm,
wigs apne Vee
Chjeot previouscd. rer"? pre se
2 wh 120
Object Next O,.,. Tete ? :
. 3 fe
Vow: remove ct? rednove = gery es “ane ©
“8° trapare yoravesel: 23, oo.
Claas steralorDer? a
tc _ - eg
peobhc stéafic yoo | prin CHG AGRI
7 wre Nh :
Array hese liér = al+ Letlecratt;
cobile Clér » hasvexrt0))
sqsters. cut printla ( hér. next)
E
3
3
Collectcoo colle ctrons
. bea er 6 wa ablhég Mace Det
* Greve 8 cai! ayer * lt clefines Severe! er eyed?
gene, obstecr, le Conlain otate rmethedl ool
6 Co SelSS
2019 $3 CS JAVA MA
trina
Pare b #tad! deiplaaia Cparo Gerd (0 7 0g
puble dass eG a
: blta dake volt Me CHEZ og
Peblte :
‘ a
Ht fe!
Bring = 3= apP.
— ar = w@ 5- bo Chat Ara CP 5
« s
for Cie P20; 0°. S lergto©s +) :
for Ciné j= Pal jued- lengh02) Srt.
22 arliD ©
vw Wy