In the previous lesson we saw how Java and C# are similar in many respects. However, there exist some differences between the two, too. Some of the major differences are listed below:
- C# has more primitive data types than Java and has more extension to the value types.
- C# supports safer enumeration types whereas Java does not have enumeration types.
- C# also has support for struct which are light weight objects.
- Just like C++ and unlike Java, C# has support for operator overloading.
- C# has the concept of 'delegates' which are type-safe method pointers and are used to implement event-handling.
- C# supports three types of arrays:
and multi-dimensional jagged arrays.
- C# has restricted use of pointers. In Java there is no concept of pointers.
- Unlike Java and C++, the 'switch' statements in C# has been changed such that 'fall-through' behavior is disallowed.
- Unlike Java and C++, C# has support for class 'properties'.
- Unlike Java and C++, C# has support for nullable primitives.
- Unlike Java in C# methods can have named, ref and out parameters.
- C# introduces the concept of indexers, which was not available in C#.
Next >>> Lesson No. 4: Our First C# Program