A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Certification
»
Programmer Certification (SCJP/OCPJP)
Author
Strings
Karu Raj
Ranch Hand
Joined: Aug 31, 2005
Posts: 479
posted
Dec 24, 2005 05:26:00
0
It prints True
what is the line at /////////////ABC does ???
if( "String".endsWith(""))///////////////ABC
System.out.println("True");
else
System.out.println("False");
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
I like...
posted
Dec 24, 2005 22:54:00
0
The empty
String
("") can be found anywhere within a String...
class EmptyStrings { public static void main(String[] args) { String str = "abcde"; for (int x = 0; x < str.length(); x++) { int y = str.indexOf("", x); System.out.println("Starting at " + x + ", empty String at " + y); } } }
(Consider that in mathematics, for any set S, the empty set is a subset of S.)
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award."
~Joe Strummer
sscce.org
I agree. Here's the link:
jrebel
subject: Strings
Similar Threads
Regd. Strings...
equals() and ==, doubt
String problem
equals() and ==
"abc"=="abc"?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter