Talk:Comparison of C Sharp and Java: Difference between revisions

Content deleted Content added
Tbjablin (talk | contribs)
Reply to enum concerns
Tbjablin (talk | contribs)
m Made comment pretty
Line 12:
 
In Java 5.0 enums are lower case, like types, and have their own syntax.
 
<code>
private enum Coin {
Line 22 ⟶ 23:
 
Also enums can be used in switches. Classes cannot be used this way.
 
<code>
switch(menu) {
Line 45 ⟶ 47:
 
In Java even arrays are technically classes ie
 
<code>
Object o = new int[10];
</code>
 
Further compiling:
 
<code>
public class Test {
private int enum = 10;
}
}
</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)
private int enum = 10;
^
1 error
</code>