Talk:Comparison of C Sharp and Java/Archive 1: Difference between revisions

Content deleted Content added
syntaxhighlight & fix lint
 
(2 intermediate revisions by one other user not shown)
Line 98:
In Java 5.0 enums are lower case, like types, and have their own syntax.
 
<syntaxhighlight lang="java">
<code>
private enum Coin {
penny(1), nickel(5), dime(10), quarter(25);
Line 105:
public int value() { return value; }
}
</syntaxhighlight>
</code>
 
Also enums can be used in switches. Classes cannot be used this way.
 
<syntaxhighlight lang="java">
<code>
switch(menu) {
case FILE:
Line 124:
break;
}
</syntaxhighlight>
</code>
 
Check out
Line 133:
In Java even arrays are technically classes ie
 
<syntaxhighlight lang="java">
<code>
Object o = new int[10];
</syntaxhighlight>
</code>
same in c# --[[User:Motherofinvention|Motherofinvention]] 01:05, 29 June 2006 (UTC)
Further compiling:
 
<syntaxhighlight lang="C#">
<code>
public class Test {
private int enum = 10;
}
</syntaxhighlight>
</code>
 
Yields the error:
 
<code>
Test.java:2: as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
(try -source 1.4 or lower to use 'enum' as an identifier)
Line 153 ⟶ 152:
^
1 error
</code>
 
My inclination is to call it a keyword, because of the new syntax, and the compiler error.
[[User:Tbjablin|Tbjablin]] 04:34, 9 Mar 2005 (UTC)
: Yeah, it seems pretty clear that <code>enum</ttcode> is a keyword in Java. [[User:Neilc|Neilc]] 01:08, 10 Mar 2005 (UTC)
 
Keyword or not, <code>enum</code> is a feature of all (or nearly all?) programming languages in the C language family, and as such is uninteresting in this context. I've deleted the reference, hope that's OK... [[User:GregorB|GregorB]] 12:37, Apr 29, 2005 (UTC)
Line 322 ⟶ 320:
== AfD result ==
 
{{oldafdfull|date=October 18, 2005|result=keep|votepage=Comparison of C Sharp to Java}} [[User:JIP|&mdash; <fontspan colorstyle="color:#CC0000;">J</fontspan><fontspan colorstyle="color:#00CC00;">I</fontspan><fontspan colorstyle="color:#0000CC;">P</fontspan>]] | [[User talk:JIP|Talk]] 10:32, 25 October 2005 (UTC)
 
== Changed name from [[Comparison of C Sharp to Java]] ==
Line 630 ⟶ 628:
 
The following text, specifically the highlighted section, is inaccurate. Java does not support variadic functions in any release.
<blockquote>"With the Java 5.0 release, this trend may have been broken, as it introduced several new major language features: foreach statement, autoboxing, <fontspan colorstyle="color:red;">methods with variable number of parameters (variadic functions)</fontspan>, enumerated types, generic types, and annotations. It should be noted that all of those, except generic types, were already present in C# by that time, some under different names.[13]"</blockquote>
Specifically, this text appears under [[Comparison of C Sharp and Java#Popularity and evolution|Popularity and evolution]], in the [[Comparison of C Sharp and Java#Usage|Usage]] section.