Both Java and C# are general purpose computer programming languages. Java was developed by Sun Microsystems with a GNU General Public License. C# was developed by Microsoft and approved as a standard by the ECMA and ISO.
Some of the major differences between Java and C# are as follows:
Table: Difference between Java and C#
S. No. | Features | Java | C# |
---|---|---|---|
1 | Definition | Java is an object-oriented computer programming language developed by Sun Microsystems. | C# is an object-oriented computer programming language developed by Microsoft. |
2 | Runtime Environment | Java runs on the Java platform with the help of the Java Runtime Environment (JRE) | C# runs on the Common Language Infrastructure (CLI), which contains the executable code and runtime environment. |
3 | Database Connectivity | Java Database Connectivity (JDBC) is used for connecting Java with databases. | ADO.NET is used by C# to access data and data services from a database. |
4 | Arrays | Arrays in Java are a direct specialization of Object. | Arrays in C# are a specialization of System |
5 | Conditional Compilation | There is no support for Conditional Compilation in Java. | C# supports conditional compilation using preprocessor directives. |
6 | Exceptions | Java supports both checked and unchecked exceptions. | C# supports unchecked exception. |
7 | Map Interface | Java supports HashMap that provide a basic implementation of map interface using (key, value) pairs. | C# contains a Dictionary that is a collection of words and their definitions in (key, value) pairs. |
8 | Type Safety | Java type safety is safe. | C# type safety is unsafe. |
9 | Delegates | There is no support for delegates in Java. | C# supports the concept of delegates. |
10 | The goto statement | There is no support in Java for goto statement. | C# supports goto statement. |
11 | Data Types | In Java, the built-in data types that are passed by value are called primitive types. | In C#, the built-in data types that are passed by value are called simple types. |
12 | Packages | Packages are used in Java to prevent naming conflicts, to control access etc. | Namespaces are used in C# to keep one set of names separated from another. |
13 | Structures and Unions | Java do not support structures and unions. | C# supports structures and unions. |
14 | Operator Overloading | There is no concept of operator overloading in Java. | C# supports the concept of operator overloading. |
15 | Super keyword | Super keyword refers to the immediate parent class instance. | For super keyword in Java, there is a base keyword in C#. It is used to access the methods and constructors of base class. |
Avery good write-up. Please let me know what are the types of C# libraries used for AI development.
very satisfied!!
Good tutorial. Small question: Say, there is : enum numbers { one, two, three} and a string field_enum ="one" how would I from the variable field_enum have a response with value numbers.one so that it can be treated as an enum and not as a string. making a list from the enum, and loop into the list. is not elegant... and may not work is forced value on field is forced ( one = 100).
Hi Team Knowledge Hut, Thank you for such an informative post like this. I am completely new to this digital marketing field and do not have much idea about this, but your post has become a supportive pillar for me. After reading the blog I would expect to read more about the topic. I wish to get connected with you always to have updates on these sorts of ideas. Regards, Kshitiz
The reason abstraction can be used with this example is because, the triangle, circle. Square etc can be defined as a shape, for example.....shape c = new circle(5,0)...the abstract object c now points at the circle class. Thus hiding implementation
Leave a Reply
Your email address will not be published. Required fields are marked *