Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Comparing Java 7 and C# 3</strong></p> <p>(Some features of Java 7 aren't mentioned here, but the <code>using</code> statement advantage of all versions of C# over Java 1-6 has been removed.)</p> <p>Not all of your summary is correct:</p> <ul> <li>In Java methods are virtual <em>by default</em> but you can make them final. (In C# they're sealed by default, but you can make them virtual.)</li> <li>There are plenty of IDEs for Java, both free (e.g. Eclipse, Netbeans) and commercial (e.g. IntelliJ IDEA)</li> </ul> <p>Beyond that (and what's in your summary already):</p> <ul> <li>Generics are completely different between the two; Java generics are just a compile-time "trick" (but a useful one at that). In C# and .NET generics are maintained at execution time too, and work for value types as well as reference types, keeping the appropriate efficiency (e.g. a <code>List&lt;byte&gt;</code> as a <code>byte[]</code> backing it, rather than an array of boxed bytes.)</li> <li>C# doesn't have checked exceptions</li> <li>Java doesn't allow the creation of user-defined value types</li> <li>Java doesn't have operator and conversion overloading</li> <li>Java doesn't have iterator blocks for simple implemetation of iterators</li> <li>Java doesn't have anything like LINQ</li> <li>Partly due to not having delegates, Java doesn't have anything quite like anonymous methods and lambda expressions. Anonymous inner classes usually fill these roles, but clunkily.</li> <li>Java doesn't have expression trees</li> <li>C# doesn't have anonymous inner classes</li> <li>C# doesn't have Java's inner classes at all, in fact - all nested classes in C# are like Java's static nested classes</li> <li>Java doesn't have static classes (which don't have <em>any</em> instance constructors, and can't be used for variables, parameters etc)</li> <li>Java doesn't have any equivalent to the C# 3.0 anonymous types</li> <li>Java doesn't have implicitly typed local variables</li> <li>Java doesn't have extension methods</li> <li>Java doesn't have object and collection initializer expressions</li> <li>The access modifiers are somewhat different - in Java there's (currently) no direct equivalent of an assembly, so no idea of "internal" visibility; in C# there's no equivalent to the "default" visibility in Java which takes account of namespace (and inheritance)</li> <li>The order of initialization in Java and C# is subtly different (C# executes variable initializers before the chained call to the base type's constructor)</li> <li>Java doesn't have properties as part of the language; they're a convention of get/set/is methods</li> <li>Java doesn't have the equivalent of "unsafe" code</li> <li>Interop is easier in C# (and .NET in general) than Java's JNI</li> <li>Java and C# have somewhat different ideas of enums. Java's are much more object-oriented.</li> <li>Java has no preprocessor directives (#define, #if etc in C#).</li> <li>Java has no equivalent of C#'s <code>ref</code> and <code>out</code> for passing parameters by reference</li> <li>Java has no equivalent of partial types</li> <li>C# interfaces cannot declare fields</li> <li>Java has no unsigned integer types</li> <li>Java has no <em>language</em> support for a decimal type. (java.math.BigDecimal provides something <em>like</em> System.Decimal - with differences - but there's no language support)</li> <li>Java has no equivalent of nullable value types</li> <li>Boxing in Java uses predefined (but "normal") reference types with particular operations on them. Boxing in C# and .NET is a more transparent affair, with a reference type being created for boxing by the CLR for any value type.</li> </ul> <p>This is not exhaustive, but it covers everything I can think of off-hand.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload