0 ratings0% found this document useful (0 votes) 27 views10 pagesJava Assgn.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
ASSIGNMENT- 1
fee
————
Oo Demraonncronke torn handling dn Tava,
Aol:
am simon,
@ sry, clon vepreantnts chorauer sErrgs. AL Nong Literals
dn Tove program, ore irrplememted Utounten thin clown
O SoRWPp ane Conner, Hhein values can’t be chomyed
of tr thay one areaked
© Str buffer cupport murtable strong. Becaune, Aa
Ore one duet le, thay ton be Ahonedk. 4
Seynkow =
soang wor > “ob 0")
Equivalent to
hon dokat J=L'o' b' 0! G7
Ary ALT= Nes SOHF (aka);
Lei Hot UL Ur abe");
ARNG ede = "ede";
Mysto UL. prndln, CYabcl4 cher
ENG = abe ’ Mabaving (2, 3);
KANG d= ede. Abatrng Ct,2);Cprratiown ef Semin
OD semry, Conca nonng 102
@ stxng dobensrcon (aving #2 IE Conve Osa Ue
onineare dfettev
Tt Conca kere
va riage he speatiged,
@ Seng vo Seige DL velar she vale
objet . Chea)
@ string telppr Cone: ae converts @ AEG Ae epper
con Letter
© seang 2m Or Lt semove whi
ng ao ee ana fem both
© soingrvelucdpO + me vets the sere repoeserTat
a of apecepcet Mallee "4
@D Sevag dub ieningtg > ok vet a none owing whtch,
in pucbstaing Of Apt fied oy
at vétlims & formatted Bing saning
format w01ng 4 serspusrens
© seing_fowmat() >
ingested Secale,
ce vetuas Unroned serleg.
| © sawing into:
|
|
D seieg_veplacelchencld, chomnued > ea “weplacer alt
Qeeurences of Spectfied chon valine
dint LenypthO» Toe aeturnr penny Length
bodlean in ErpeyO) > Tek checks Sp steer ae Up ly
bool ean Contains ( Chan sequence) x IM sete eaute/ falne
ayer waatching the sequence of chow vale
sndlex)e px we ethan valine pe
wehvan chan Ht Core
pererartan and ve
chan boy a
sect amatn): Checks the cprality, Of
Dering nel object
booteen kquatalo
@
e
@
@
®
fH) publec claw sompled
pul 1 mate vor Main (tering Ongpec dL
ny MOL ll", AeEL= “HOMA'Y
eae aN 7
oped uk panele Cate. tomcat C4t¥2));
Wee clans Sampled
geatce Vord main (SKY ann ODL
face ae b> eo"
Se aatene gut: PHAR ( wtevt, ko Upper Covet Dt
nai gt Tre ak encTOTO D EI I LIED
RO: — pablee claw Sampled [st cod. ® °?
\ ce vot rain (SAY AngPlD, emenncrahe VT eer
fie enor wenpur ple yin save.
dyes. out prnrbr (Bere 0); soln” Lie ton de Junput fhe showndtany | abe oluepue
4 Phe Ron dling on Tawo un Lingus
CARP operators
5
equine te a women of SEVP GE AtGuEme Of LORE Thine
vd. pubic claw Sampled
pablee stasse vor moc Cttang Orgcy)y LANEY athing HES EC
suming ate "could @ neghee ous Samdarel OLEPAEA LON
ave
Ayton 0a, portlr ( 507 lengths): @ gre. EN: Meaunhorech pn pur Serene
i agen en Bader Enno ab Cone
3
Tung ann suonal bubelam ine TpUrtyTeow te
xO: chan bentatring comparunon $ £ © Audsornpur Seveawe
parler Atatte VO maim CStming Avg CIWS @ Byte rsray Input Sortan
te achen” © File tnput seven
REG cunsaw") @ Fitterrngur Sevcar
out. pre SL 4y): © Saving Rup pEn Tepue Str tous
ayarens cut printdin (SE Lengan Cu); 6 Sojeckunttun teow
$
5 Syne Lo wrente Emp ter terr
aopubsistins obj s new File aeputieerean
wethods 6 taput Stetars
iets ey ee
Readty = Re
0 = Reads one byfe sf data from cnput at-vean
@ Rect (byttlI amray) = Reads byte from the sereart ¢
Kiowa hak byte sin Apecspeecl 27 rRf,=e ae
Se eterna ened ent agg au
Gon ban been send,
@ Pvaclobleta: — RET Urme dh number Of bytes avaclable
DEnpuk ater earn
© ranksupponed’y: i Chae oh ee eae
ene () murkod ws BUpponE Jon BEE Ehiny
Renn
© wesek©d: Ret tty contre, tet 7 “ aoe ves
Bek Lande Aten
@ Sep: seep Goenvve prrtccettan ng of bet — from inpur
“porte
8 Choe: Clove sinpit stream
ocopy Input pile stOourpak file +
dingok Je 60.
public clans ConyFited
public ntekee Yo rain C AtxnG CypPCI)
oo
Filelnput trem ens rackt;
File Ouputsit Decne Out = wal
ed
vino Mew Feletiputitsean Chospus tb");
Ou > Neer File Ouputs SCrtium (Mourpub. txt"
Gant C
DEle (Ces instadr) 1 =
£
Gue bre CO;
5
goratag
Cf Con = nut)
Lain.lowey;
v
AY Cowes = At
Out, chose lr;
4
AY
3
sed boreal & nce a ale ak atte p
cagore Ftv tou;
Phe Chews Copyiiled
lec gtaete vord nan se C2)
re ving Oy
Lu
File Rensden sin = real;
File batten Cub uth;
ark
ins = Teter File Reader (" Onpubatet ");
Out = near File BHI (9 guaran txt”),
aint cj
bble CC ¢ =tn.2tahOn = 19
Lt
our erik (09,
3
3 brats!
af Cont =m)
en Mane;
u
2 (oat! = matt)
“
out , close J;
ze ttae
separ JONG LO.
pub etam ReathCowelet
ule, Aewbee vaid rain C At NG APC) rs
ae a
© Oerswrrart curpur file hamdling in gave
: cuskpae AEReOm dy usted Te UAH dake KO Mamuncuh
repubdtecon Rewer Gin > maul; 5
sent Seyret Aubchames 9{ Ougppuk Sorte
eon = pes TAPER SKFEEMR LA (iegttorn in GD Biyte Ais uy Cot pud Raker
Segcens. out prineln C° Grrtn Chanson ® a7 £0 qui’, @ File Curpurser tom
© Seng wophin Cukput eetan
shan ©; @
Obstet Ouepur Stream
dod . © pave ousput Serta
c= Chow) tin vead 0; © Printieram
Byron out: prot (Oj
4 _Ov ing CUA pUrst rene
itd Corey’): cuunpatit eens Obj = nes Pe Cumpucttrtons (2;
fonatly, £
f eh seetans
I Cone matt) 2 nent ony
tian chores: RIEL © Laie nL apeerpged hype! te OULU FETE
x © wwe Coy Davsey - porter bytes which ave tame e
7 a epecifge Aw LO CHK PU AE weRm,
@ Corel: clone the euctputs stwear
5
@ funkto: Force te wate afl daca prevent oy
utpur Atrcam sto devtinationanspor juve Co. Fleur;
Lnport Java.Co, IOEXceptton;
public chew GFL
puatee stakio vord! pecan C ADS TI Ory),
ee
File wrcken bvcken
= nuns Pele rctea ( Mmybile. tty,
porthole ("Flt Ge TAVE are,
aewowly good! /”);
bret, close Yj
dipters out. prrtln("ouccerfully enetten ”).
q
catch 1OEKeeption €) §
Ayptees Cub. prem "An exvoy har occured"
2. prtntstack Pra cel
5
‘
J
As grok =
© Explatn asst sn Tava.
soln
Apr rtewds for Abstract weder toolkit 4 an
cappiietion programming unttrface CAFI) Jor pas BUBOnE"UEOK Hare's
b. set Bounds( 50, 108, 50,30);
foodd Cb;
Mp debe 4 (1409, 100);
p_ sekbasgour (mitt;
qe ee wetcele Clete)
4
4
|S
© Explain Aikegatn and Lvents ah Tava
dole:
Ddleqones:-
a method It come comrntlined a vefrence foo
wrebhod jas ot Atores Mehads Aigmetunre | vetom
Hype Dulegores con be srt BP pars methods ce
aagumenta 20: 6thin mecthods “Tha an actreenely
auedful Arik allows fpv Code eumnabititiy §
dynamic bonding of methods
TA an object -owenetoL ype tncapautering
Searle
punice delegenre int Cobeterte (OEE, Omeyg);
publec cat Add Coax, enty)
& cetunn aig:
a
Catectare cole > Add,
wink TOWEL = Cle 3,4)
aa oho wrangle, Cateatare delegate in olelaud veh
a stom type of ant, Ft ane paramerns, “The method
Add a then Created Lith Matern
Fenatly, te pd method tae sacgred
“big aantung ak to the cole, varweble
Lan now be wed to call
greture
bo delegate
The cate vavable
nad meted ae seen ar te Lane tins of codeEven: Gant one Speaat Dype of deteyate hat Con
Seely en objec vitm something Happen, Events
et. font Taned LO Communitars by objects ,
dohan one objec® Oe, ct can rett|y Olin obj wees
by rasteny an eve
Exonmple |
parue Wen Eventhandlan Something HAppensd ;
prvate vec Bosometbang O
. H (Something Aeppinect)
Svan angie new EvencangiCy;
Something Happened Cth, args J;
a
3
rn anove ample, am event Called, Sorredhing HOp pened
dedliaed. Tnnde tte bo Something method, 9 fondizeon
da checked, tp ae a tase hen CWE ws wecreds
Lanning Something Hagppemede viicatle
Lintening pos tho won ball be
Domerneny Sen happen ¢d.
+ Aimy Other objects
notopoed thas
Aatamcliacon, pelepeks allow for methods fo be panel
an Ongwrnerts © Uhile Merits abl fer objects #0
Commanizoxt HR Lah OH, Dorking WeHh obelegere
Levent com Letp make Code mart vreusable & dyna
Demowwerake — Kilypowrd AMMO un AWengs
Kiyhertntr pore we Tawa suredt 10 Lester
for Weighowecl ett 8th Os keay Premta §
fag pelea, Tur colon I PORTO to vespord,
owner mpuk -fFOrt Kbighonat Bh ae
lexwuiah for busily antine cceve appleceason
perhodé Tava Kay Luter
D Key Prone * Mwokh Lhin key 2 proved tonne
@ kujReleoreds Calttel Ubon @ Kiyo velo
@ Key Typed: Fovel Whew a Kuz pron | release
rroulia ara Character
pore
ore | fava. noes Ey
Den Oe a as
publec slam Key lateren Example extends Frame
sriplements Hybesrentn {
prvace Tet Field bent Feld;
prvate Label ceaplaylates
Att Lejeut (Rte Flow Layee)
kext hid = nes ‘Text Feta (20)
tect Freld add kegleatenes CH):
odd ( vexttreld);daplay Label = new Label (¥ Typed Teet
cdc Cacsplay Label y
Ret Fo cur able Ct wed;
BEFOUU Travenn alkey Ehabled, ( fatoer;
ba Veschle (tire )7
5
public vocdk Koy prenied ( Key Event e) L -
ant Key Code = te. getkey dey,
Syren ou pantie ("Key Poomed: "4.
Koay Event agutkuy Text Ckey code ))-
7 :
public vood Kay Poomedl Chey Event e)
unk Keylode= e. FH Key del);
Apter neu, prorin ("Ery Reeaneal 2" 4 Kuyevent,
Yok Key Text (Fey ode ));
3
pubic vood Ky Typed (key Event e) f
than Ku rors ¢, yer kry rar o
AyAtum OU: prtt C" Keg Tupect: 4 Key Char J:
danpleup Lobel . £eLTeceC'1eypeol Text: gp texted,
qertext0)4 Key chon J)
5
public Atatic void main ( Sexngly ars §
new Keryliskentr Excumple (47
j 4