Almost six years ago I wrote an article entitled C# from a Java Developer's Perspective which is still one of the most popular comparisons of C# and Java on the Web today. This update to my 2001 article comparing the primary features of C# and Java is a few years later than I planned. Given the amount of requests I've gotten to update it to account for the changes in Java 1.5 and C# 2.0 I'm sure there are many out there who'll find it useful. Below is the table of contents so you can jump to whatever topic interests you.

  1. The More Things Change The More They Stay The Same
    This section describes concepts and language features that are almost exactly the same in C# and Java.
    1. We Are All Objects
    2. Keyword Jumble
    3. Of Virtual Machines and Language Runtimes
    4. Heap Based Classes and Garbage Collection
    5. Arrays Can Be Jagged
    6. No Global Methods
    7. Interfaces, Yes. Multiple Inheritance, No.
    8. Strings Are Immutable
    9. Unextendable Classes
    10. Throwing and Catching Exceptions
    11. Member Initialization at Definition and Static Constructors
    12. Boxing

  2. The Same But Different
    This section describes concepts and language features that differ either only in syntax or in some similarly minor manner between C# and Java.
    1. Main Method
    2. Inheritance Syntax
    3. Run Time Type Identification (is operator)
    4. Namespaces
    5. Constructors, Destructors and Finalizers
    6. Synchronizing Methods and Code Blocks
    7. Access Modifiers
    8. Reflection
    9. Declaring Constants
    10. Primitive Types
    11. Array Declarations
    12. Calling Base Class Constructors and Constructor Chaining
    13. Variable Length Parameter Lists
    14. Generics
    15. for-each Loop
    16. Metadata Annotations
    17. Enumerations

  3. An Ever So Slight Feeling of Dèjà Vu
    This section describes concepts and language features that exist in C# that are similar to those that exist in Java but with a significant difference.
    1. Nested classes
    2. Threads and Volatile Members
    3. Operator Overloading
    4. switch Statement
    5. Assemblies
    6. Collections
    7. goto (no longer considered harmful)
    8. Virtual Methods (and final ones too)
    9. File I/O
    10. Object Serialization
    11. Documentation Generation from Source Code Comments
    12. Multiple Classes in a Single File
    13. Importing Libraries
    14. Events
    15. Cross Language Interoperability

  4. Now For Something Completely Different
    This section describes language features and concepts that exist in C# and have no Java counterpart.
    1. Deterministic Object Cleanup
    2. Delegates
    3. Value Types (Structs)
    4. Run Time Type Identification (as operator)
    5. Properties
    6. Multidimensional Arrays
    7. Indexers
    8. Preprocessor Directives
    9. Aliases
    10. Runtime Code Generation
    11. Pointers and Unsafe Code
    12. Pass by Reference
    13. Verbatim Strings
    14. Overflow Detection
    15. Explicit Interface Implementation
    16. Friend Assemblies
    17. The Namespace Qualifier
    18. Iterators (Continuations)
    19. Partial Types
    20. Static Classes
    21. Nullable Types
    22. Anonymous Methods

  5. Wish You Were Here
    This section describes language features and concepts that exist in Java and have no C# counterpart.
    1. Checked Exceptions
    2. Cross Platform Portability (Write Once, Run Anywhere)
    3. Extensions
    4. strictfp
    5. Dynamic Class Loading
    6. Interfaces That Contain Fields
    7. Anonymous Inner Classes
    8. Static Imports
  6. Conclusion(2001)
  7. Conclusion (2007)
  8. Resources
  9. Acknowledgements

 

Monday, 30 April 2007 20:00:27 (GMT Daylight Time, UTC+01:00)
Re: Checked Exceptions -- you want to reference an interview with Hejlsberg where he dicusses his issues with checked exceptions. http://www.artima.com/intv/handcuffs.html
Ricky Dhatt
Monday, 30 April 2007 21:03:18 (GMT Daylight Time, UTC+01:00)
>Cross Platform Portability (Write Once, Run Anywhere)

Silverlight 1.1 ('Anywhere' does mean the Mac, right?) ;-)
David Ing
Monday, 30 April 2007 21:03:20 (GMT Daylight Time, UTC+01:00)
Dare - you might want to use Java 1.6 instead of 1.5 (here's a quick summary of 1.6 -- http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/beta2.html)
Comments are closed.