C# is a general-purpose, modern and object-oriented programming language pronounced as “C sharp”. It was developed by Microsoft led by Anders Hejlsberg and his team.
Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented etc. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture.
Below are some major differences between C# and Java:
|Operator Overloading||C# supports operator overloading for multiple operators.||Java does not support operator overloading.|
|Runtime Environment||C# supports CLR(Common Language Runtime).||Java supports JVM(Java Virtual Machine).|
|API Control||C# API are controlled by open source community.||Java API are also controlled by open community process.|
|Public Classes||In C#, there can be many public classes inside a source code.||In Java there can be only one public class inside a source code otherwise there will be compilation error.|
|Checked Exceptions||C# does not supports for checked exception. In some cases checked exceptions are very useful for smooth execution of program.||Java supports both checked and unchecked exceptions.|
|Platform Dependency||C# is cross-platform and runs on both Windows & Unix based systems.||Java is a robust and platform independent language. Platform independency of Java is through JVM.|
|Pointers||In C# pointers can be used only in unsafe mode.||Java does not supports anyway use of pointers.|
|Conditional Compilation||C# supports for conditional compilation.||Java does not supports for conditional compilation.|
|goto statement||C# supports for goto statement.||Java does not supports for goto statement. Use of goto statement will cause error in Java code.|
|Structure and Union||C# supports structures and unions.||Java doesn’t support structures and unions.|
|Floating Point||C# does not supports strictfp keyword that means it result of floating point numbers may not be guaranteed to be same across all platforms.||Java supports strictfp keyword that means its result for floating point numbers will be same for various platform.|
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Java.util.LinkedList.poll(), pollFirst(), pollLast() with examples in Java
- Java.util.LinkedList.peek() , peekfirst(), peeklast() in Java
- Java.util.function.BiPredicate interface in Java with Examples
- Java.util.function.DoublePredicate interface in Java with Examples
- Java.util.function.LongPredicate interface in Java with Examples
- Java.util.LinkedList.offer(), offerFirst(), offerLast() in Java
- Java.util.function.IntPredicate interface in Java with Examples
- Java lang.Long.numberOfLeadingZeros() method in Java with Examples
- Java.util.concurrent.Phaser class in Java with Examples
- Java.util.Collections.rotate() Method in Java with Examples
- Java lang.Long.lowestOneBit() method in Java with Examples
- Java.lang.Short toString() method in Java with Examples
- Java lang.Long.reverse() method in Java with Examples
- Java Deprecated API Scanner tool (jdepscan) in Java 9 with Examples
- Java lang.Long.byteValue() method in Java with Examples
- Java lang.Long.highestOneBit() method in Java with Examples
- Java lang.Long.numberOfTrailingZeros() method in Java with Examples
- Java.util.Collections.disjoint() Method in java with Examples
- Java.util.BitSet class methods in Java with Examples | Set 2
- Java.util.concurrent.RecursiveTask class in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : prkhandelwal