This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes A question about equals Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A question about equals" Watch "A question about equals" New topic
Author

A question about equals

Gnome986
Greenhorn

Joined: Jul 10, 2001
Posts: 11
[code]
Which methods can be legally applied to a string object?
a.equals(String)
b.equals(Object)
c.trim()
d.round()
e.toString()
the answer is a b c d e
my question is focus on a.
because i have viewd the api for jdk1.3 and i merely find the method of equals(Object obj) at the the class of String.So i think the answer shouldn't include a.
my english is poor so i don't know if i explain clearly.
Scott Appleton
Ranch Hand

Joined: May 07, 2001
Posts: 195
A String "is an" Object and is therefore a legal argument to any method which takes an Object as a parameter.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

Also, d is incorrect. You cannot round() a String.


Junilu - [How to Ask Questions] [How to Answer Questions]
Gnome986
Greenhorn

Joined: Jul 10, 2001
Posts: 11
Thx
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Hi gnome986,
Please read the JavaRanch Name Policy and re-register using a name that complies with the rules.
http://www.javaranch.com/name.jsp

Thanks for your cooperation.

------------------
Co-Moderator of the Programmer Certification Forums


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
wood burning stoves
 
subject: A question about equals
 
Similar Threads
validating equals method
null exception!
== and equals arent clear yet ... look at this
Strings
EQUALS method