Java vs. C#

Shared Features


Java & C#
  • Strongly typed object-oriented language
  • Built on C++
  • Compiles into machine and language independent code(byte code/IL code)
  • Executes in a managed execution environment(JVM/CLR)
  • Elimination of pointers(C# allows code marked unsafe)
  • Classes all descend from object/Object
  • No header files
  • No global functions or constants
  • No more ->, :: operators
  • All code scoped to packages or assemblies
  • Everything belongs to a class
  • Objects must be allocated on the heap with new keyword
  • Arrays and strings with lengths built-in and bounds checking
  • All values are initialized before use
  • if statement takes boolean condition as an argument
  • try blocks can have a finally clause
  • Thread support by putting a lock on objects(lock/synchronized)
  • Subclass only one superclass
  • Implement multiple interfaces
  • Inner classes
  • Garbage Collection behind scene
  • Powerful reflection capabilities
NOTE: This is not an exhausted list.