views:

2568

answers:

20

Possible Duplicates:
Should I learn C# or Java?
Should freshers learn Java or C++?

I have an option of selecting Java or .NET as my language.

Which one is the best to choose? In which can I see a brighter future?

+32  A: 

Want to see the brightest future? Learn both.

Juliet
They are both sufficiently similar that learning both really shouldn't be too difficult of an option either.
Kibbee
Why learn both. Learn one and a dynamic or functional lang?
John Nolan
Yeah, no reason to learn both when you can spend the time learning something more different. Learn one (flip a coin if you need to) and pick the other up if/when you need it.
Adam Jaskiewicz
I disagree. Better to be really good at 1 thing than OK at 2 things.
Keltex
No reason to learn both, really. If you must learn two, go with C# and F#. Otherwise just learn C# =)
Dmitri Nesteruk
@Keltex - seconded. Become a master at one or the other. Then become a master at something related and useful in combination like SQL or Javascript. Finally, once you can go for senior dev positions in your chosen path then it can be worth learning the alternate. Want to see the brightest future? Learn either until you're an expert, it doesn't really matter which.
Keith
+2  A: 

Noone knows which one has the brighter future (apart from Jon Skeet). And what is better is a personal / subjective question. Personally i go with java. But C# has some very neat features and i plan to learn it too. Nothing against knowing one more language :).

Java implementations support more platforms. Note that's not a property of the Java language. It's merely a property of the implementations. But mono already works quite well on three quite major platforms and it can compile C# code for Linux/Windows/MacOS.

Johannes Schaub - litb
Mono is not that good, it doesnt support c# 3.0When you use c# you should forget about mono.
geeeeeeeeeek
i'm not that good with c# . but i know mono supports linq (though i think it does only partially). C# 3.0 is fully supported in mono since 2.0. i've asked them in the #csharp channel on irc.freenode.org
Johannes Schaub - litb
Mono is useless.
Shubh
@Shubhkarman: It is NOT
abatishchev
@geeeeeeeeeek: Mono partially supports even .NET 4.0. So 3.5 is almost fully supported
abatishchev
+1  A: 

Learn C# from dot net and also Java If you master one of these, you are cool.

codemeit
+2  A: 

It would be interesting to see which of the two seems to have the larger question/answer audience on SO.

Fortunately, they are similar enough that techniques and patterns you learn for one are usually transferrable to the other.

le dorfier
+3  A: 

They are both really great languages!

I would learn both, master one, then learn ruby || python || groovy || scala to round it out. Problem with .Net and Java is that they are both Monolithic languages with lots of ritual and things you need to do that don't always make sense until you understand how compilers and type checking really work.

Learning a great dynamic language will improve your Java or C# thanks to the DSEP (Dynamic side effect phenomenon) where learning about duck typing, polymorphism and other dynamic nuances actual improves your statically typed OO code.

Then again C# will support native Duck Typing in 4.0 along with some great functional programming paradigms so I would start hedging my bets on that one over the big J.

ewakened
+5  A: 

Learning both only opens more doors for you in the future. If one is becoming less popular, you will still have something to fall back on. It's almost inevitable that you will learn a second language anyway as your first language is rarely your last, and having a tough decision between these two I feel you will end up learning them both somewhere down the road anyway. Not to mention how many resources there are out there for helping programmers of one language convert to another, a quick search on Amazon will reveal a myriad of books for Java developers wanting a taste of C#, and the other way around. More knowledge never hurts, as long as it's useful knowledge.

John T
+1  A: 

Look at the number of Java programmers envious of C# and compare it with the number of C# programmers envious of Java. Compare the numbers and decide. (I'm sure most people know which group has majority.)

Dmitri Nesteruk
I don't know. Which group is it? :)
Hosam Aly
Seriously, which group? Maybe this site's members have a partiality toward C#?
Jack BeNimble
Umm, my perception is that the Java folks are envious of C# generics, lambdas and such. Am I wrong? Yes, SO is biased towards C#, so perhaps I'm not seeing the full picture =)
Dmitri Nesteruk
I've used both C# and Java extensively. I used Java up until the point that I got excited by the new C# language features. But after a while I realised that they don't actually buy you all that much, at which point I switched back to Java because of the better underlying platform and open source libraries / toolsets. I now use Clojure on the Java platform - so I get best of both worlds, lovely functional language and the best platform for my needs.
mikera
+5  A: 

Start with C# and then learn Java.

I find it easier to set up the C# developer environment - Visual Studio. There are probably more jobs about for C#.

That said, Java is very useful, particularly on Linux and for general portability. Mono is good but not as mature as the Java implementation currently.

pro
I had a recruiter tell me that so many people have gone the C#/.Net route that people who know Java well are in high demand. I think right now Java developers might have a slight edge in terms of competitiveness in the marketplace.
thaBadDawg
If that's your criteria - learn COBOL! (no, seriously, its big bucks for the few who know that stuff)
gbjbaanb
+1  A: 

I'm fairly fluent in both Java and C#. I think any programmer who can become solid in one language the translation to the other language is fairly simple. The main difference is one of integration. It's harder to integrate Java into the Microsoft world and C# (much less so now than before) is harder to work with outside of the Microsoft world. Once Mono catches up with .Net 3.0 I would be hard pressed to say that Java has the edge.

When I am working in Java I miss the ease of which I can work with web applications and web services. When I am working in C# I miss the myriad of libraries that make development speedier and much more effective. I especially miss Javolution when I am working with C#.

Learn C# first then start tracking some Java open source projects and you'll see how easy it is to code in both worlds.

thaBadDawg
+1  A: 

Fortunately Java and C# are very alike, so it is not difficult to pick up the other after learning one of them. I suggest you start by learning the language where you can find immediate use for it. Real projects are needed for real experience with a language imo.

Brian Rasmussen
+2  A: 

C# seems to be evolving more quickly than Java. I don't know if this is good or bad. If you know C# then you can pick up Java pretty quickly and vice-versa. The libraries take a longer time to learn than the languages.

Jules
+1  A: 

I think they are so similar that it's not really an either/or. I'm currently learning Java for Android development (started with c# about 5 years ago) and I'm finding that it's easy to pick up.

You want to branch out? Try a functional language. That will bend your brain around nicely. F# would be my choice, since in .NET you can include C# and F# assemblies (or is it by class?) in the same project. There are some things that functional languages really do do better. Or at least easier on the dev, since it all goes down to bytecode in the end.

jcollum
+3  A: 

I would advise to go with Java first. C# is very rich as a language (IMHO), up to the point that I actually find it confusing for new developers. On the other hand, Java has a relatively concise syntax. So I'd advise to go with Java first.

I wouldn't be talking about libraries here, because these are tools that can enhance your productivity, but are not actually part of the language. There are also many debates that can be made over GUI libraries, platform independence, multiple vendor support, and many other stuff. But if you really want to learn well, then I would advise you to start by learning the language itself, and know about libraries on your way. Afterwards, you will be able to switch to the other language relatively easy.

By the way, I am not saying that C# is bad (regardless of my personal opinion). I am just saying that its richness can make it hard to learn for new developers.

Hosam Aly
A: 

One thing about Java is everything is free. With Microsoft, I assume you end up paying somewhere along the line. Another thing is Java runs on both Windows and Unix. I don't think C# does this. Finally - a quick check of Dice.com reveals approximately double the postings for Java as it does for C#. I can't vouch for the trend, though.

Jack BeNimble
Get your facts straight before you answer.
Echostorm
He's more-or-less right. There's mono, but it's not really a production solution from what I can tell. Windows certainly isn't free, so he's got that right.
Adam Jaskiewicz
Again with the lack of simple research. http://www.mono-project.com/Companies_Using_MonoAdditionally, bringing the price of Windows into this is irrelevant. Computers cost money so the price of developing anything is not free.
Echostorm
EchoStorm - Mono "doesn't attempt to duplicate the complete .Net environment". Would you develop for cross-platform on a product like that? I have many years of dealing with Microsoft as research, and have the lightened bankroll to prove it. I'd never had to pay a cent to Sun. Twice-burned, etc.
Jack BeNimble
+1  A: 

Look at job postings in your area. Learn whichever one seems to be more popular. It really doesn't matter. I'm a Java programmer, but I've looked at a fair bit of C# code and it seems very similar; I don't think I'd have any trouble picking up enough to be productive in a few weeks.

Adam Jaskiewicz
+3  A: 

Right now .Net is the more dynamic place to be - Java's ability to run on anything also makes it harder to change. Meanwhile Microsoft can keep adding to .Net very quickly.

You can use .Net on Linux, but you're tied to an old subset of the language.

In either case it will take longer to learn what you can and can't do with the supporting frameworks than the language itself. Also bear in mind that C# basically robs the best bits from Java - there's not a massive difference between them.

I wouldn't bother learning both - very very few jobs require it. In terms of your career you're better off learning some different but complementary languages.

I would go with SQL, either C# or Java, and finally plain Javascript with at least one framework (jQuery, prototype, etc).

Basically, to me as a hiring manager, C# + jQuery or Java + SQL would both be worth more than C# + Java.

Keith
+6  A: 

I would choose Java... Here's why (don't downvote please, I'm not trying to start a holy war, just pointing my observation)

  • corporate .NET harbors many junior developers (including senior dudes who are junior developers) as well as junior managers
  • consequently, the junior .NET crowd seems to favor predictability over innovation and tends to believe in Elixir of Eternal Youth and the Philosopher's Stone (a joke by Dijkstra)
  • JVM ecosystem seems to lead the innovation in the areas of design, architecture and best-practices (IoC, ORM, EIP just to name a few). Open source .NET community is mostly playing catch-up game, with projects like NAnt, NHibernate, etc. Truth be told, there's a radical cutting edge crowd in .NET too (sometimes known as Alt.NET) but its reach is limited and its projects often die in version 0.2
  • JVM innovation is mostly driven by OSS community (and therefore diverse), while .NET innovation is almost all driven by large players like Microsoft (ASP.NET MVC, C# language enhancements) and Novel (Mono).
  • in terms of language innovation, with JVM you're not limited to Java, there are Groovy, Clojure and Scala; finally, you can even coexist with JRuby. there are alternative languages in .NET too: Boo, IronRuby, Delphi Prism but they are either too niche, lacking community support, or belong to corporations that are likely to drop them at any moment.
  • Java gets better exposure to fresh blood of non-Microsoft developers (from *NIX), while .NET is comprised of predominantly Microsoft-centric crowd (we will see how Mono changes that in the future). Fresh blood brings fresh ideas.
  • Also, according to some popularity indexes (e.g. TIOBE), Java is more popular than C# and VB.NET combined, which means more jobs for you to choose from.

Hope this helps.

zvolkov
Thanks for sharing your opinion.
Warrior
A: 

Learn Java.

And then learn Scala.

Scala is sufficiently different that learning both is not redundant, and sufficiently close (Scala can use Java's libraries) that you can leverage your knowledge of the vast APIs available for Java.

Scala is also pretty far ahead in terms of language innovation.

Marcus P S
A: 

i would learn .net first since majority of jobs are in .net right now and then do java

codewrath
+1  A: 

You should be able to Hello World in both. Many people I know end up having to learn the other later. The question is really, "What should I learn right now?"

What do you develop on/for? .NET is highly integrated with the Microsoft web stack. Java is more cross platform.

Then you make a decision, "Do I want to learn the thing that deepens or broadens my experience?"

Generally, I want to broaden my experience when I'm learning. That's because I'm not a Java or C# developer.

I am just a developer.

Thomas Langston