0 ratings0% found this document useful (0 votes) 96 views6 pagesJava Assignment2
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
ee et.
W) equats LObecto) “This method x
Companes athe sraciied
Object worth 4Ws collection
OM
Maat
vi) “NoahCedel) “Wa memod as wed to Ket dhe
Nosh code vahue ie Shu collection,
viii) asEmpay ©. Wis method — getunns dswe Ab sth
=e
colleebon contains no element .
1x) Hesxaton) “This method steams an idesatos
Ovex athe elements an ais collection.
YY mort) “This metnod wa wed do Ketusn the
MOWmam value present Jn dhe calloction. \
XY poscallel Sineam ()
Mis method xetugms a posaltel
Skxeam with ahis collection
as dks — sousice, i
Uvii) gemove (Object_o) This method 43 used do semove
dhe Anes object pxom the
collection . Sb dhexe axe duplicate ~ values , then
dha metnod xemoves the eae occurence sy the
OR
Lily sremoveAbt (Collection c) Tia method Js ured do
sxemove all she cbieots
mentioned in the ayen collection Ros the
collection.
) “This method ww used to
Wiv) — wemovelf | Predicate
semove alt the etements
1 this collection hot are oh the. quer
predicate ,(XV) gekaimAd CCablection c) “This method dd wed to setain
ay dhe elemerts im dhs
collection ahad axe centained in dhe ie
collection
Ow xe Wis method ds wed do xetuim the
number elements in she collection.
Usv gpitewator ) “Tas method bs wed do cxeadle o
Gpditenotox oven dhe elemerds in
dn Collection.
bait) Gdxeom) “Ws method da used do setum a
Sequential Btxeam wreih {is collection
SOURCES ,
ix) U_ Ww method ww used do sxetusm On
| ott + the elemends
mM ais collection.iy mance hes loot ds ured ty ue
decimal ay oF oe
value Js 6 ond hos o aize 4 bytes
has aw infinite yotue 94 oe
Exompte - Phoat ae aB.as;
iy Cranacten Dota 7 “ype. Chon as dhe name ste
———
is Usekul ye ae
> Value ehosocters. 44 has a sixe a a?
a Value slange Lier hetween ‘\u00o Lom 0)
sto ‘NURRER Com 651635 inctusive ).
fw Exampte- chan a= ‘Dp’;
Ape ty) Byte. Dato” . Dato Type Oe On 8 vit aigned use’
a Complement .~The Fang
ie
Valuer axe - 498 ao 429. The byte el A
ds used do save memo m meas eat
‘
Ww Short Dota. Tipe fis Z dimes smollen thou
Ame integen ‘data 4 pe. a
Value sange Lies
bedween §-92,268 40 BAI? .
Exomple - “shoot a = 54;
Wy Jone Doda Doda Type $ Sis iG So IRA eae sc coud
stounges 80m - 25> go (2,63)
has a sixe of 8B tye ae wale pte
need do store data which us en thaw
dnt dotatype ,
iy Double Data Tyre [ie hat soniokae ey ae te
“Wis Go siwilod do oct dota Ayre
pe Jt howe dwo values ‘tue’ and
& hoo 0 de value
eae ¢ o oe oe
wi)te
\7
2
7
Ganbage Calection
TAL 4s pmocess h srecloums the suntime unused
ee | putome nt In othen woxds » it wa
w 6 destnoy the unused objects -
jt mokes eee ident because (hose colloctoan
semoves the unhetexented objects
gto ete done by she e 2 eoblectox.
eau be ME de
2. By assiqua oO exence 46 another.
Thexe axe shee ways an ak
1 By mubli athe Sefexence
o oi cue obje
Fimotine L)_metrod 44 is calted evesy time betone
ae e colletted.
St can be used do pestonm cleanup process
an object
=i meet “Ie ge C) mexmod Jy ured to imucke
dhe gasbage coltectox do peel
cleanup Rea ie ee in Gystem and
Runtime chassed- A
Example Gosb: ‘tt Coltectiow
public class Test crarbage {
pubsic ved fimotixe U4 System-oud youd “objec s ct cobteded’9
pubsic stakic void meow! cel cxgs CDE |
TestGraabage $1 = new Test Kes yy |
Testtnesboye 52 = new “VestGraxbage L))
al = null;
g2. null)
rem: 90>
itt