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

Content deleted Content added
Tbjablin (talk | contribs)
m Made comment pretty
rv test
 
(819 intermediate revisions by more than 100 users not shown)
Line 1:
{{User:MiszaBot/config
How does Java have a simpler language? The CLR has some JIT time optimizations as well as runtiem optimizations. Java and C# run at about the same speed really. It might not be true that Java is faster.
|archiveheader = {{aan}}
|maxarchivesize = 100K
|counter = 3
|minthreadsleft = 4
|algo = old(90d)
|archive = Talk:Comparison of C Sharp and Java/Archive %(counter)d
}}
{{WikiProject banner shell|class=List|
{{WikiProject Java |importance=low}}
{{WikiProject Computing |auto=}}
}}
{{Archives |bot=Lowercase sigmabot III |age=3 |units=months }}
{{Broken anchors|links=
* <nowiki>[[Arbitrary-precision arithmetic#Arbitrary-precision software|software for arbitrary-precision arithmetic]]</nowiki> The anchor (#Arbitrary-precision software) [[Special:Diff/633704642|has been deleted]]. <!-- {"title":"Arbitrary-precision software","appear":{"revid":33896264,"parentid":33891953,"timestamp":"2006-01-04T22:34:11Z","removed_section_titles":["Uses","Software examples"],"added_section_titles":["Applications","Algorithms","Arbitrary-precision software"]},"disappear":{"revid":633704642,"parentid":632305701,"timestamp":"2014-11-13T19:24:31Z","removed_section_titles":["Arbitrary-precision software","Libraries","Stand-alone application software","Languages"],"added_section_titles":["Software libraries"]}} -->
}}
 
== Modules ==
The article needs to be cleaned a bit... Some entries are listed as both advantages for one language and disadvantages for the other, which is at best redundant. Otherwise, it's not bad; quite complete now. [[User:GregorB|GregorB]] 22:49, Jan 31, 2005 (UTC)
 
A section is missing: what are the differences between java's packages and C#'s public/internal visibility keywords on namespace members (which end up correlating with the CLR's modules and assemblies). [[User:Bohan|Bohan]] ([[User talk:Bohan|talk]]) 12:21, 28 July 2018 (UTC)
I think there is good reason for pointers to be listed as both an advantage and a disadvantage for C#. I don't think there exists enough consensus about whether pointers should be used in managed languages. It might be appropriate to go into more detail about how pointers are implemented with relative safety in C# on another page and then link it. [[User:Tbjablin|Tbjablin]] 05:36, 8 Feb 2005 (UTC)
 
== Type inference / manifested ==
I've decided it belongs in differences after all. [[User:Tbjablin|Tbjablin]] 05:44, 8 Feb 2005 (UTC)
 
At least C# supports basic type inference support: https://stackoverflow.com/questions/479883/how-good-is-the-c-sharp-type-inference [[User:ShalokShalom|ShalokShalom]] ([[User talk:ShalokShalom|talk]])
* Both languages allow the use of enumerations, via the <code>enum</code> keyword.
 
== Comparing Stream API and LINQ ==
As far as I recall, this is false. C# uses the <code>enum</code> keyword, whereas Java uses a Class ([http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Enum.html link java.lang.Enum]) introduced in Java 1.5. I haven't edited the page to reflect this, as I am unsure and would like confirmation first.
There is a paragraph for LINQ but not for the Java Stream API. Comparing them would be more consistent with the rest of the article. I might add this part in the future but don't have time right now <!-- Template:Unsigned IP --><small class="autosigned">—&nbsp;Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/141.79.34.38|141.79.34.38]] ([[User talk:141.79.34.38#top|talk]]) 23:41, 21 January 2024 (UTC)</small> <!--Autosigned by SineBot-->
 
In Java 5.0 enums are lower case, like types, and have their own syntax.
 
<code>
private enum Coin {
penny(1), nickel(5), dime(10), quarter(25);
Coin(int value) { this.value = value; }
private final int value;
public int value() { return value; }
}
</code>
 
Also enums can be used in switches. Classes cannot be used this way.
 
<code>
switch(menu) {
case FILE:
System.out.println("FILE Menu");
break;
case EDIT:
System.out.println("EDIT Menu");
break;
case FORMAT:
System.out.println("FORMAT Menu");
break;
case VIEW:
System.out.println("VIEW Menu");
break;
</code>
 
Check out
http://java.sun.com/developer/technicalArticles/releases/j2se15langfeat/
http://zamples.com/JspExplorer/samples/jdk1_5.jsp
http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html
 
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>
 
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)