top

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 *

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