top
April flash sale

Search

C# Tutorial

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.FeaturesJavaC#1DefinitionJava is an object-oriented computer programming language developed by Sun Microsystems.C# is an object-oriented computer programming language developed by Microsoft.2Runtime EnvironmentJava 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.3Database ConnectivityJava 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.4ArraysArrays in Java are a direct specialization of Object.Arrays in C# are a specialization of System5Conditional CompilationThere is no support for Conditional Compilation in Java.C# supports conditional compilation using preprocessor directives.6ExceptionsJava supports both checked and unchecked exceptions.C# supports unchecked exception.7Map InterfaceJava 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.8Type SafetyJava type safety is safe.C# type safety is unsafe.9DelegatesThere is no support for delegates in Java.C# supports the concept of delegates.10The goto statementThere is no support in Java for goto statement.C# supports goto statement.11Data TypesIn 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.12PackagesPackages 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.13Structures and UnionsJava do not support structures and unions.C# supports structures and unions.14Operator OverloadingThere is no concept of operator overloading in Java.C# supports the concept of operator overloading.15Super keywordSuper 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.
logo

C# Tutorial

Java vs. C#

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.FeaturesJava
C#
1Definition
Java is an object-oriented computer programming language developed by Sun Microsystems.
C# is an object-oriented computer programming language developed by Microsoft.
2Runtime 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.
3Database 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.
4Arrays
Arrays in Java are a direct specialization of Object.
Arrays in C# are a specialization of System
5Conditional Compilation
There is no support for Conditional Compilation in Java.
C# supports conditional compilation using preprocessor directives.
6Exceptions
Java supports both checked and unchecked exceptions.
C# supports unchecked exception.
7Map 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.
8Type Safety
Java type safety is safe.
C# type safety is unsafe.
9Delegates
There is no support for delegates in Java.
C# supports the concept of delegates.
10The goto statement
There is no support in Java for goto statement.
C# supports goto statement.
11Data 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.
12Packages
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.
13Structures and Unions
Java do not support structures and unions.
C# supports structures and unions.
14Operator Overloading
There is no concept of operator overloading in Java.
C# supports the concept of operator overloading.
15Super 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments

austin faith

Avery good write-up. Please let me know what are the types of C# libraries used for AI development.

kariya arti

very satisfied!!

jean-Francois Michaud

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).

Kshitiz

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

Ed

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

Suggested Tutorials

Swift Tutorial

Introduction to Swift Tutorial
Swift Tutorial

Introduction to Swift Tutorial

Read More

R Programming Tutorial

R Programming

Python Tutorial

Python Tutorial