Content deleted Content added
MalnadachBot (talk | contribs) m Fixed Lint errors. (Task 12) |
syntaxhighlight & fix lint |
||
(One intermediate revision 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">
private enum Coin {
penny(1), nickel(5), dime(10), quarter(25);
Line 105:
public int value() { return value; }
}
</syntaxhighlight>
Also enums can be used in switches. Classes cannot be used this way.
<syntaxhighlight lang="java">
switch(menu) {
case FILE:
Line 124:
break;
}
</syntaxhighlight>
Check out
Line 133:
In Java even arrays are technically classes ie
<syntaxhighlight lang="java">
Object o = new int[10];
</syntaxhighlight>
same in c# --[[User:Motherofinvention|Motherofinvention]] 01:05, 29 June 2006 (UTC)
Further compiling:
<syntaxhighlight lang="C#">
public class Test {
private int enum = 10;
}
</syntaxhighlight>
Yields the error:
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
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</
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 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, <
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.
|