If you ever dare Googeling “Java vs C#” you will undoubtly be witness to the religion wars that exist between the opposing factions of syntax warriors. I’ve always just seen both languages as great tools, but it was not until recently I saw just how similar they are.

I was polishing my knowledge of searching and sorting algorithms, and I was doing a binary search in C#.

Later I was writing the same code in Python and then in Java. After having confirmed my solutions I thought my Java solution was quite similar to my C# solution:

C#

Java

Python

Javascript

PHP

 

It turns out there is one thing that seperates them. C# uses arr.Length (note Capital L in Length) where Java just uses length. I also did one in Python, Javascript and PHP – they’re all quite similar too