C# vs java

C# vs. Java—Often Developers asked which general purpose, object-oriented programming language is best for you? Both have extensive libraries that can be used to build applications for the desktop, web, mobile devices, and other platforms. Both have large communities of enthusiastic fans, and plenty of online support. With so much in common, selecting the right language requires a more nuanced approach. Let’s take a closer look at the similarities and differences between C# and Java.

But first we will discuss about what is c# and Java.

What is C# and when its introduced to us?
C# is pronounced as “c sharp” .The name “c sharp” was inspired by a musical notation where a sharp indicates that the written note should be made a semitone higher in pitch.Similar to language name c++ where “++” indicates that c is incremented by one.So from name we can assume that c# is is incremented version of c++ .It is a multi-paradigm programming language that first appeared in 2000 As a part of Microsoft’s  initiative and later approved as a standard by Ecma and ISO . C# is one of the programming languages designed for the Common Language Infrastructure. It’s Developed by  a team which is lead by Anders Hejlsberg.The latest version

The most recent version is C# 7.0 which was released in 2017 along with Visual Studio 2017.

What is Java  and when its introduced to us?
Java was initially released by Sun Microsoft in 1995.It’s a general purpose programming language which was created with keeping a specific goal in mind which is “Write code once and run anywhere” .Application which are Developed with Java are fully portable to cross platforms ,It gives java a very big community .
From past of software industries created various new programming language  in the search of perfect general purpose programming language.The motivation behind creating any new programming language is  If some weakness exists and is exposed in the older language, and then shown to be nonexistent or hidden in the newer language .As we know java came before c#,c# developers learned from weaknesses and strengths of java .So from this we can say that c# has fill several weaknesses  of java. But that does not mean c# is a perfect language if its perfect one there is no reason to create new programming languages.There are several new languages introduced each day to fill the gaps and to make an ultimate programming language.C# and java both are good object oriented programming languages in present ,Below we will try to identify which one is better.
In this discussion, we will make small parts of this big topic into small categories and finally see which language wins.The Major differences between c# and java are,
i)Portability: Java was created to archive full portability in developing application.This mean java was created to full fill the purpose of   “Write code once and run anywhere” .Java source code is compiled into intermediate byte-codes, which are then interpreted at run time by a platform-specific Java Virtual Machine (JVM) .That’s how compiled java source code can run in many platforms like Windows, UNIX, Linux and many more.
C# is not portable like java. C# is also compiled to an intermediate language,called MSIL.
Just like byte-code,at run time MSIL is converted to operation system and CPU specific code.
But in present MSIL only supports  windows operating System.
Currently, In this category Java is winner as it is supported on more operating systems.
ii) Polymorphism:C# and Java take  different approaches to polymorphism. While Java enables polymorphism by default,But for C# must invoke the “virtual” keyword in a base class and the “override” keyword in a derived class.
iii)Complexity:c# is a more complex language than java.In java it does not directly interact with the hardware.It seems as if java was built to keep developer from shooting himself.But incase  of c# it could use c++ features which allowed it to directly access the hardware.C# can be seem as a gun but leave the safty turned on and who often want ultimate firepower can control it .
So,we find out that c# is a more complex language.
iv) Checked Exceptions: Java can distinguishes  two types of exceptions—Compile time and Run time.For this purpose Java defines a java.lang.RuntimeException type, which is a subclass of the base class of all exceptions, java.lang.Exception . C# chose a more minimalist approach by only having one type of exception. While the ability to catch exceptions can be useful, it can also have an adverse effect on scalability and version control.
v)Operator Overloading: Operator overloading is a type of polymorphism in which an operator is overloaded to give user defined meaning to it. Overloaded operator is used to perform operation on user-defined data type.For an example if we overload operator “+” then it be use to different purpose rather than just sum between numbers.
Java does not support operator overloading.To reduces complexity and make it simple  java developers does not include operator overloading .So java can be easy to write and useful for building complex applications in very few .
On the other hand c# supports operator overloading but it is not like c++. There are many operator that cannot be overloaded in c# like “new” or many others that you can overload in c++. So C# supports operator overloading, but in a much lower level than c++ or other languages that fully supports it.
vi) Multiple Inheritance:Java does not support multiple inheritance to make it a simple language its removed.
c# supports multiple inheritance,it makes it a complex language but also gives many features.
Then which is better ??
Both c# and Java have so much in common,The language you should choose will depend ultimately upon the platform you have chosen for your project, if you are developing an project for windows users only then you can choose c# or in the case of cross platform you have to choose java.
Keep in mind that you will get pros and cons using both languages and neither language is likely to disappear anytime soon.Both language are very good general purpose object oriented languages.Bottom line,Choose the language that works best for your project’s platform of choice
If you don’t have that much time, You can check that table bellow on difference between c# and java for quick review .you can see it here as well as you can download it if want.


To download this image click on –  Download
Thank you, for reading.If you have any queries mail me at tempDestroyer@gmail.com

You May Also Like

About the Author: Anup Das

Hello, my name is Anup Das. I'm a blogger who is addicted to programming.


Leave a Reply

Your email address will not be published. Required fields are marked *