aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interesting string methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interesting string methods " Watch "Interesting string methods " New topic
Author

Interesting string methods

Sarma Lolla
Ranch Hand

Joined: Oct 21, 2002
Posts: 203
Except the last two every thing else prints true.
[CODE]
public static void main(String [] args) {
System.out.println("String".substring(0)=="String");
System.out.println("String".substring(0,6)=="String");
System.out.println("String".replace('t','t')=="String");
System.out.println("String".replace('T','t')=="String");
System.out.println("String".toString()=="String");
System.out.println("String".replace('t','T')=="String".replace('t','T'));
System.out.println(" String ".toString()=="String");
}
[CODE]
Jasper Vader
Ranch Hand

Joined: Jan 10, 2003
Posts: 284
i guess cos the last two are the only two in which an actual change takes place? (t goes to T, the white space gets removed)...


giddee up
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interesting string methods
 
Similar Threads
== Operator
There are Strings attached everywhere!
String literals
Strings
Java Strings