oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Comparing C# and Java

by Budi Kurniawan

C# (C-Sharp) is Microsoft's new programming language, promoted as "the first component-oriented language in the C/C++ family." Despite the claim, however, many people think that C# is rather a clone of, or Microsoft's replacement for, Java. Is it true?

This article shows the evidence that C# is more than a sibling of Java. If you are a Java programmer who wants to learn or know more about C#, reading this article is the first ten minutes you should invest in.

C#, C++ and Java

Given the current hype, it is always interesting to compare C#, whose specification was written by Microsoft's Anders Hejlsberg and Scott Wiltamuth, with both C++ and Java. Considering the tone of recent IT newspapers' headlines, it is not too surprising if you already know that C# is closer to Java than to C++. For those who just joined the discussion, Table 1 below lets you see for yourself. Conclusion: Java and C# are not Siamese twins, but C#'s most important features are closer to Java than to C++.

Table 1: C#'s most important features compared with those of C++ and Java






Single class inheritance, multiple interface implementation

Multiple class inheritance

Single class inheritance, multiple interface implementation

The notion of interface

Through the "interface" keyword

Through abstract class

Through the "interface" keyword

Memory management

Managed, using a garbage collector


Managed, using a garbage collector


Yes, but only in the rarely-used unsafe mode. References are used, instead.

Yes, a very commonly used feature.

Not at all. References are used, instead.

Form of Compiled Source Code

.NET intermediate language (IL)


Byte code.

One common base class




After these outlined important features, read on to find out some important differences between C# and Java.

Pages: 1, 2, 3, 4

Next Pagearrow