Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

C sharp vs Java: C sharp is almost a clone of Java heres a list  RSS feed

 
Ranch Hand
Posts: 246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


C sharp ( C# ) vs Java

Similarities of C sharp and Java:

C# and Java have single class inheritance only and multiplue interface implementation

both have interface keyword

both use Garbage collector
both use references and not pointers. ( in C sharp in unsafe mode pointers can be used )

C # and java has one common base class
both have exception handling
packages in C sharp are called namespaces
both have public, private and protected

in C sharp extends is called control

the keyword sealed is the same as final in java

is keyword is same as instanceof in java

Stringbuilder is almost the same as Stringbuffer

try and catch is the same as in Java as in C sharp

for loop and do-while loop is the same in java as in C sharp
break, continue, return are all the same in java and C sharp

Methods in java and in C sharp are same !

upcasting and downcasting is very similar in C sharp
Differences of Java and C sharp:
The main difference in .NET vs Java virtual machine is that;

In .NET only 3 languages work with it and are in beta
In java over a dozen languages have been ported to it !
http://www.onjava.com/pub/a/onjava/2001/02/15/jvm.html

in Java you can create enums in C sharp they are their for you
structs are in C sharp and they act as a "dumb" class
no shift >>> operator in C #

variables in C sharp are full objects not primitives.

goto is in C#

Operator overloading exists in C sharp
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting
 
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually there is operator overloading in Java also. The + is both addition and concatenation.
Lot's of interesting notes there. How did you get them?
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah that is interesting stuff...
You know what. It doesnt matter if .NET is better or Java is better. If the product is good and is useful for people it will stay around and grow. I think to much is being played on the fact Java might be dead or Microsoft is to late with C#....
If people like it and use it, it is here to stay. Java was once a new language and it grew and won many people over
Faze
 
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, a list like this is very useful for those who know one of the two languages and want to learn about the other one. It's a very efficient way to learn about a language. On the other hand, if the purpose was to show that c# is a rip-off of java, then you're right, it's pretty silly. One might just as well complain about how java is ripped off from C++, or c++ was ripped off from c, etc.
Re: operator overloading in Java - no, real operator overloading. As in, users may overload operators themselves. Java's + for concatenation is just a faint echo ofwhat's possible in C++. In fact James Gosling has indicated that operator overloading could well make it into Java one day, as he underestimated its importance to some groups of programmers - particularly those doing heavy numerical computations.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO: It doesn't mean much if they are largely sytacticaly similar though. (i realise there are also non-syntactic differences)
I heard 'round the water cooler that the new version of VB has 'greatly' modified syntax that appears to be an intermediate step between the old VB and C# syntax. This is possibly as a scheme to force current VB developers to migrate to C#. Haven't touched VB in years so could anyone else comment?
Dave.
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Superficially Java appears to be similar to C++ because of the syntax. But f you compare language features it becomes clear that Java's closest relative is Delphi. The chief architect of C# Anders Hejlsberg used to work for Borland once. He is also the chief architect of Delphi. Delphi had been around for many years before Java came into existence. The similarity you noticed was because both languages were ripped off from Delphi. Since Hejlsberg is the creator of Delphi all he is guilty of is repeating himself. So can we let him off with a suspended sentence this time?

[This message has been edited by Sahir Shibley (edited August 03, 2001).]
 
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Delphi/Java link is simply incorrect. As someone who worked with Delphi when it first came out, (around the same time that Java did) I can assure you that Visual Pascal (which is what Delphi was) and Java had little in common. There were great similarities in the Borland IDE and the Visual Cafe IDE but that had nothing to do with the respective languages. Anyone who thinks that Java is a ripoff of Delphi doesn't know the history of either product.
 
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or mystifies us
 
erich brant
Ranch Hand
Posts: 246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of my college professors said that Java is 80% similar to C++.

Another professor, commenting in an article in some newspaper or mag ( I forgot which ) said that C++ being backward compatible with C is a huge bug, since the language is not allowed by default to ever stand on its own legs.
 
Sahir Shibley
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Thomas Paul:
The Delphi/Java link is simply incorrect. As someone who worked with Delphi when it first came out, (around the same time that Java did) I can assure you that Visual Pascal (which is what Delphi was) and Java had little in common.


Delphi is Object Pascal, never heard of a language called Visual Pascal. Over and above the similarities between all object oriented languages Delphi and Java have a lot more in common than Java and C++. A few of the similarities are the object reference model , RTTI , use of interfaces to implement (a sort of) multiple inheritance , abstract methods. I woudnt say that the object reference model was ripped off from Delphi because both languages probably ripped it off from Eiffel
[This message has been edited by Sahir Shibley (edited August 04, 2001).]
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yep. I never heard of a language called Visual Pascal either
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think all languages are taken from each other - since it all comes down to 0 and 1
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Delphi was built around the IDE. The selling point back when Delphi 1.0 came out for Windows 3.1 was the visual development environment. Its main competition at the time was not C++ but PowerBuilder. Object pascal would have had little notice in the market without the visual IDE.
 
erich brant
Ranch Hand
Posts: 246
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by David O'Meara:

I heard 'round the water cooler that the new version of VB has 'greatly' modified syntax that appears to be an intermediate step between the old VB and C# syntax. This is possibly as a scheme to force current VB developers to migrate to C#. Haven't touched VB in years so could anyone else comment?
Dave.


Dave,
I work, in part, with ASP. A few months ago, I was invited to a Microsoft "introduction" to the ASP.net technology. While I was there a couple of things were blazingly apparent. First, the big move/ introduction of object oriented concepts into the ASP model. Second (and most startling), the extreme confusion of the audience.
The "intro" should have taken an hour or two; however, the questions regarding the OO concepts pushed the "clock" to well over 4 hours (at which time,I left ).
I have not worked with .NET directly and I don't intend to focus much, if any, further time on it. Still, based on the presentation I witnessed, I agree with the "water cooler" assumptions.
Suzanne
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Sahir Shibley:
Delphi is Object Pascal, never heard of a language called Visual Pascal. Over and above the similarities between all object oriented languages Delphi and Java have a lot more in common than Java and C++. A few of the similarities are the object reference model , RTTI , use of interfaces to implement (a sort of) multiple inheritance , abstract methods. I woudnt say that the object reference model was ripped off from Delphi because both languages probably ripped it off from Eiffel
[This message has been edited by Sahir Shibley (edited August 04, 2001).]


Sorry, but we know that Java has its origin in Smalltalk (concepts of OO)and not Delphi, with its syntax from C++. Of course Java and Delphi have similarities; they are both OO. But that's all.
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what's the news??? Everybody knows that nearly all the M$ products are nothing but a wrapper over something that they ripped off or hijacked or blatantly copied.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Anders Hejlberg:

Yep. I never heard of a language called Visual Pascal either


Gee, Anders, you must be spending too much time in the bright light of Bill Gates. A google search on "Visual Pascal" came up with more than 200 hits.
 
Ranch Hand
Posts: 2373
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In any case, i think the main differnce iss the huge amount of supports from many parties/community. Java is much more matured already in this sense. But .Net is at least an excellent option for so-called Visual Basic programmers....
------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer for the Java� 2 Platform
--When you learn something, learn it by heart!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!