This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A question about equals

 
Gnome986
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[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
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A String "is an" Object and is therefore a legal argument to any method which takes an Object as a parameter.
 
Junilu Lacar
Bartender
Pie
Posts: 6529
21
Java Linux Mac Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, d is incorrect. You cannot round() a String.
 
Gnome986
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic