Using C# Interfaces
C# and Java: Two Sides of the Same Coin?
The more I look at C# and Java, the more similarities I see. C# is inextricably interwoven with the .NET platform, whereas Java is platform-neutral. Like many great rivalries, both languages probably contribute useful ideas to each other. Where both of these languages are similar is in the system area. To dig into the system level, you tend to need C or C++, because system-level programming (such as device drivers, memory management, and so on) tends to live outside the virtual environment of managed languages.
However, before we predict the demise of the likes of C and C++, we must remember that C is the development language of choice for many smaller platforms. And so it goes: As new platforms are developed, the older languages often are dusted off and used for developing applications. This multi-language world is good news for developers, because the complexity is so great that we're still needed—maybe now more than ever.
Should programmers specialize in C# or Java? I suggest a flexible approach: Try to acquire excellence in one while maintaining knowledge of the other. Obviously, your day-to-day work will dictate what language you use, but in uncertain economic times it's good to be able to move from one mainstream language to another.
With this goal in mind, let's examine the C# interface, which bears a close resemblance to the Java interface. We'll start with a really simple example and build on it throughout this article.