This is a highly debatable question with Java developers supporting the argument that Java is better than C# and vice versa. However, there are some parameters we can look at when comparing both languages. It would be upon the developer from either side to choose what they want to implement and whether they can get it in that particular language or not.
What C# lacks that java has
1.Lack of type for arbitrary sized decimals.
2. Checked Exceptions -(Actually very annoying to many developers. Most would like it optional)
3. Dynamic Class loading
4.Anonymous Inner classes
5. Portability in the sense of write one run anywhere- C# programs have to be recompiled for different operating systems
6. multiple inheritance
What Java Lacks that is available in C#
1. Operator overloading
2.Unsigned Integers
3.Value types(Structs)
4.Turples
5.Pointers
6.Nullable types
7.Complex numbers
8. Unified Type system
9. Delegates
10. Properties
11. Indexers
12.Preprocessor Directives
13.Aliases
14.Runtime code generation
15.Partial types
16. Static classes
17. Anonymous methods
18. Dynamic types
19. Verbatim string declaration
20. Multi dimensional arrays
21. Lambda expressions
22.Events
23.LINQ
24. Using statements eg
(using SqlConnection con = new SqlConnection()) {
//Statements.....
}
What did not exist in java but was added after C#
1.Collections
2.Boxing and unboxing
3. Foreach loop
Conclusion:
Having some features lacking in one language may not necessarily mean that the language is inferior. There can be other ways of implementing the system without necessarily requiring the unavailable features. You cannot be creating a system in java and you get stuck halfway because java doesn't support delegates. There are other ways of doing it without using delegates.
C# was developed later than java so some feature may be present in C# but lack in java. However, with time, they may be added or supported in various ways. Also the features lacking in C# but available in java may not necessarily be required in C# or they may be viewed as bad practice in C#. Such include extending more than one class. You can rest assured that it will never be added in C#. If you want to inherit methods from various classes, an interface is the way to go. Don't be shocked if it becomes a standard or trend in future.
Programming is more than just a programming language. It's more about the programmer. You can be able to accomplish almost anything with either language regardless of what one language has or what the other doesn't have.
0 comments :
Post a Comment