How is C# Different From Java?

C# and Java are both object-oriented languages that derive their syntax from C and run in a managed environment.  There are, however a number of differences.  Here are the main ones:
  • Syntactic differences, e.g. “class B extends A” instead of “class B : A”
  • Java doesn’t use namespaces
  • C# lock statement vs. Java synchronized statement
  • C# has a few more access modifiers than Java
  • In Java, enumerated types are full-fledged classes
  • C# allows strings in switch statements
  • C# programs make use of the .NET Framework; Java programs use the Java SE