Here you will find 15 differences between C# and java with explanation.
DIFFERENCE BETWEEN C# AND JAVA
S.N | C# | JAVA |
1. | File extension name : .cs | File extension name : .java |
2. | Run Time Engine /Manager : CLR (Common Language Runtime) | Run Time Engine /Manager : JVM (Java Virtual Machine) |
3. | It supports static constructor | No static constructor in java. Java supports only static block |
4. | It supports structure, union & enum | It does not support structure, union & enum |
5. | Like c++, it supports operator overloading | It does not support operator overloading |
6. | It supports both call by value & call by reference | It supports only call by value |
7. | The output of C# application is : .exe (It does not support .jar file) | The output of Java application is : .jar (It does not support .exe file) |
8. | IDEs: Visual Studio 2010 / 12 / 13,15,17,19,22 etc, …, SharpDevelop, VSC Editor | IDEs: NetBeans, Eclipse, IntelijIDEA, VSC |
9. | 1st letter of Main() method must be capitalized in C#.NET | 1st letter of Main() method need not be captailized in java |
10. | File name & class name need not be same in C#.NET Ex. test.cs public class Hello { … } | File name & class name must be same in java Ex. test.java public class test { …} |
11. | Alias concept used only in C# Ex. (right library in C#)using p=System.Console; | Java does not support alias concept Ex. (wrong library in java) import p=java.io.FileReader //wrong in javaimport java.io.*; |
12. | C# is used to import only namespaces (is called package in java) and classes can be done via alias concept. | Java is used to import both package (is called namespace in C#) and classes directly |
13. | Technologies in C#.NET 1. Desktop / Windows Applications WindowsForms / WPF(windows presentation foundation) 2. Web Application ASP.NET(C#), WPF.NET(C#) 3. ADO.NET Database Application 4. Compact Framework / WindowsPhone / Xamarin Mobile Applications in .NET | Technologies in java 1. Desktop / Windows Applications Applet / AWT / Swing 2. Web Application JSP(java) 3. JDBC Database Application 4. J2ME / Android Mobile Applications in java |
14. | C# supports new concepts like events, delegates, properties & indexers | Java does not support the C# new concepts |
15. | Default Access Modifierclass, structures : internalvariable,method, property : privateabstract class, interface : publicdelegate : sealed | Default Access Modifierclass, structures : friendly / defaultvariable,method, property : privateabstract class, interface : publicno delegates |
More Tutorials