File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes contentEquals() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "contentEquals() " Watch "contentEquals() " New topic


suresh kamsa
Ranch Hand

Joined: Jul 30, 2001
Posts: 149
Could anyone tell me how to use contentEquals() function?
String s = "hello"; //line1
StringBuffer sb = new StringBuffer("hello"); //line2
System.out.println(s.contentEquals(sb)); //line3
Its giving me error at line 3
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
What error message do you get?
Is it something about an unknown method and are you using a JDK pre 1.4? If so, if you take a good look at The String Class Documentation, you'll notice that that method is "since 1.4".

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: contentEquals()
It's not a secret anymore!