Search Results

Search found 1 results on 1 pages for 'jcgarciam'.

Page 1/1 | 1 

  • IndexOf method returns 0 when it should had return -1 in C# / Java

    - by jcgarciam
    A friend of mine came to me with this strange behavior which i can't explain, any insight view would be appreciated. Im running VS 2005 (C# 2.0), the following code show the behavior int rr = "test".IndexOf(""); Console.WriteLine(rr.ToString()); the above code, print "0" which clearly show it should have return -1 This also happen in Java where the following Class show the behavior: public class Test{ public static void main(String[] args){ System.out.println("Result->"+("test".indexOf(""))); } } Im running Java 1.6.0_17

    Read the article

1