Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, jussij is right. It is your code which is not equivalent.

Your Java code is checking reference equality while the C# code is checking string value equality. The == operator works differently between strings in C# compared to Java. The only reason the Java code you wrote might "work" is due to Java interning strings so the references could be the same.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: