String.contains in Java -


  string s1 = "quick brown fox jumps over a celestial dog"; String s2 = ""; Boolean B = s1.contains (S2); Println (b);  

I run the Java code above, the B returns is true. Because S2 is empty, why is S2 included in S1?

I check the Java API, writes:

returns returns if and only if this string has a specified sequence of character values ​​

Parameter:

s -

Sequence of search for returns:

Correct if this string is in S, otherwise it is incorrect

blank is a subset of any string.

Think about all those that are between every two letters.

The way there are infinite numbers on any line of the line ...

(Hm ... I wonder what will I get if I have an uncounted number of empty strings )

Note that "" only .equals ("") however.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -