Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
CareBear
SUBMITTED BY:
Guest
DATE:
Oct. 26, 2014, 5:33 p.m.
FORMAT:
Java
SIZE:
785 Bytes
Raw
Download
Tweet
HITS:
740
Go to comments
Report
public
class
CareBear
extends
Animal
{
protected
String
symbol
;
public
CareBear
(
String
name
,
String
symbol
)
{
super
(
name
,
true
,
2
);
String
s
=
symbol
;
this
.
symbol
=
s
;
}
public
String
getSymbol
()
{
return
symbol
;
}
public
void
setSymbol
(
String
symbol
)
{
this
.
symbol
=
symbol
;
}
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
!
super
.
equals
(
obj
))
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
CareBear
other
=
(
CareBear
)
obj
;
if
(
symbol
==
null
)
{
if
(
other
.
symbol
!=
null
)
return
false
;
}
else
if
(
!
symbol
.
equals
(
other
.
symbol
))
return
false
;
return
true
;
}
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus