Background
In my company there is many teams like Java team ,.Net Team ,testing team and so
on and between us there is always one contest that is which language is better
C# or Java and during this contest I have found some interesting advantages of
C# over Java and for that I have also won the prize from Java team...!!.
So I want to share it to all people so other can also know about it.
- C# being a .NET language, supports language interoperability, i.e. C# can access code written in any .NET compliant language and can also inherit the classes written in these languages. This is not possible in Java.
- The code written in C#, on compilation generates an ‘.exe' or ‘.dll' file which is also called Portable Executable file. These files contain MSIL (Microsoft Intermediate Language) code. As against this, the Java code on compilation generates a ‘.class' file, which contains bytecode.
- The portable executable file of C# can contain any number of classes, whereas, the ‘.class' file in Java contains only one class.
- The methods in C# are not virtual by default. On the contrary, methods in Java are virtual by default, which degrades the performance.
- The classes in C# are grouped in Namespaces, whereas, classes in Java are grouped in Packages.
- The C# namespaces are not related to the directories. The packages in Java are directly related with the directory names.
- The variables of primitive data types in C# are more powerful. This is because even though they are not objects functions can be called using them. The variables of primitive data types in Java cannot call functions.
- C# has features like Properties and Indexers. These features are not available in the Java language.
- C# supports Structures, Operator Overloading and Preprocessors directives, whereas, Java has none of them.
- Through C# we can easily call Windows API function and access COM components which is quite difficult in Java.
Summary
I hope you understand some advantages of C# over java also I am preparing big
article on this topic, you will see it soon, if you know something about it,then
share with me.

Zulqadar IdrishiPosted Apr 7, 2021, 5:55 AM
Now, It's time to rewrite your article in 2021 with new features and new comparisons.
Mahadev ManePosted Apr 11, 2017, 12:38 PM
HI, in second point: java has .jar file for executable. it executes all platforms while C# cannot.
Vithal WadjePosted Sep 15, 2014, 1:53 PM
thanks
Sopparapu HemanthPosted Apr 20, 2014, 12:29 PM
very useful bro thanQ
Vithal WadjePosted Jun 12, 2013, 5:50 AM
but these FACTS are make huge difference between these languages
Bob DenardPosted Jun 12, 2013, 4:47 AM
Most of these sentences are FACTS, not ADVANTAGES ...