Friday, March 7, 2014

Difference between C# and Java

C# and java was derived from c++ therefore they have similar roots.C# has borrowed some features from java. However, there exist a numbers of differences between c# and Java.


Java uses Static final to declare a class constant
C# uses CONST

Java does not support struct type
Its support struct type

Java does not support operator overloading
Its support operator overloading

Class members are virtual by default and a method name in a derived class overrides the base class member
In C# the base member is required to have thevirtual keyword and the derived member is required to use the override keyword

In java parameters are always passed by value
It allows parameters to be passed by reference by using ref keyword

In java switch statement can have only integerexpression
C# support either an integer or string expression

Java uses instanceof operator instead of  isoperator in C#
C# uses is operator instead of instanceof operatorin java

In java ,all c# data types are objects
C# has more primitive  data types

Java does not support directly on enumerations
C# supports enumerations

No comments:

Post a Comment