You are on page 1of 5

Hasan khondaken

Md. Hasibul
Name:
D : 2013C8204 2

Pybie class person implemens elonealble

Posivke s t i NTD
Puolie Persm (strinq NDJ
NTD
this NTD
=

podic NIDC D
stv
return NTD

3 persen eone ()+hrous


Poldlie
elone Natsupportd Exception
reurn ( Person ) Super. elone)

Rldie class perso


Private stving NTD
Publie person (stri ID)?
4his NTO « NID;
ame: Md. Hasibbl Hasan Khandafer 10: 201368 2042

Publie shrinet N#D()}


retun NID;

Publie int Compare To(Perso perso2

return 0

3
main (sting La, a7
void
P b l i c statie
erson ("I2314|
TPevson peksoni =
hew
1234341 "
2 n e t w person
Person
PerSon

It (person4. compovedo
(Person o )
ND is greter hon perssh 2
("Pensond
system. out print

dse it(Porson1. ompareto


(persoh 2) <o)}
NID is less than ferson J
system.out. pintk ("Pevson
have same
nd Person2
syem.ovt.prinTkn ("Pevsond
else
ND

Persom .eqvals (Pevson &))


ons Person dmF
don
System. ovt. printn ("Pevsohd
have some ND)
hondoker
Hasan
Aame Md. Hasibvl

fD:2013682042

elsesystem.out. printkn ("Persoh 1 d ferson


have same NTO"J:)

Person person s(Rrson Person 2.clone()1


(pevsan3, quals (eevson 2) ) {
system, out.priatln "PevsonL omd
persoh 2 have
same NTD:3

else
System. ovt printh ("Persont and person2 dont
hove some NI0"); )
Coteh (eloe Not Supported Ex
oephon e)
e. printsto.ckmceC),

(d) we all Know an d


values and
In Jowq interface Compves
lesS
esS
int maybe
etuwd an int. Thi s Values
doas ed
is
than. ft
thaneaNal 3ete
Hoson Khondaker
Navme: Md. Hasibv
1D: 2o136e2o42

value of aeh ehoveete r in the


on UnIcade

hoand
hand Compvg objeets is
strigs.on the other

es Sential feodure of oop lanuass.


eeturn
tve
+ r e foals
falke e
whieh
e y e = =|! =|<|>
we vse strin
value. fn 4his proram
USe in eonmpure
specially
atodype ond it is
vse i t in
we eant
method
to eompareto
we owt replaee
meths d so
Compaveto

it here

w e Kno
E oPerators tov refvene e eomphigon
ladd ress eomporison ond eq, val ( ) method

for eonteh t Com pari So h eavasto()nethod


evaluates to the Compa kiso
values
val jn

the obre ets, Hhe mai diFferehee oetweeh

yalsC) metho and ( p e r a t a v is


tsan Khondaken
Nae Md. Hasbul
Cp: 21682o42

S metho d and other is op eator.


that ohe

we Can t bse )
heve, in this prra m
e are vst objeets
operatov beeaU Se

You might also like