Should I learn Java or c#?

I have been coding in JS all my life (although I did PHP earlier), but I feel it is time to learn a new language and I’m torn between Java and c#. Any suggestions?

3 Likes

They are very nearly identical. There are more free resources out there that teach Java, but I find C# to be a nicer, more polished language.

It also seems like Java is more versatile when it comes to applications. Case in point mobile development and web development.
Thanks for your reply.

I’m not actually familiar with java frameworks but c# has .net and .net core with mvc and web apis for web development and xamarin for android. Admittedly you can’t write native code in c# though.

If you want to learn raw OOP and design patterns, Java is perhaps the best place to start because most books and resources are written in that language. Also if you feel like doing some big data or wanna try out stuff like Spring Boot for web dev. Not to mention most people still code in Java when it comes to Android (altho there is Kotlin and hybrids these days).

C# every year has better and better syntax and sugar. It’s a great language and its MVC framework is battle tested, has great coverage out there so you might get a job ez. It’s also great to start with desktop and windows 10 apps using XPF or WinForms.

Their syntaxes are similar so learning one will facilitate the learning curve of the other.
I personally started with C# but went to learn java in 2 weeks.

I would go for Java.

Java and C# syntaxes have much in common. So, after learning Java, it will be easy for you to switch from Java to C#.

1 Like

I would suggest you to go for C#, but if you are a beginner in the world of coding/development, then you should start with C then progress to C++ and finally C#. There is a reason to start with C, its that even though C is very primitive when it comes to programming languages out there, but its still very help full in making programming concepts strong.

Then go for C++, the reason to chose this programming language now is that after learning C you will be probably aware of many basic C operations, now you can start to learn and understand object oriented process using C++.

Once you get proficient in C++, then go for C#, mind here you will get to know many new things, but this will all be based on your previous understanding.

Also most of the programmers I know say that C# is easier to learn, understand or code then C or C++, but the truth is that nothing in this world is easier, these guys had a very good understanding of both previous languages, and C# which was made to be friendly, seemed like a cake to these programmers. Also do check out this awesome article: What Is Coding? to further strengthen your basic concepts about coding before actually starting to do it.

There is absolutely no need to learn C or C++ before any other languages. And while some C knowledge might come in handy for some of C++, they are completely different languages. And C++ is completely different than C#.

You can learn C# as your first language, and many people do. Don’t waste your time with prerequisites you’re not actually interested in.

4 Likes

I totally agree with @chuckadams on the C and C++ matter.

I am a bit biased on the choice between C# and Java. I’ve learnt Java together with OOP methodologies (the come naturally together) years ago in university (and it’s still the language they use there for the courses).
I’ve never touched C nor C++ even once and that surely didn’t block me from learning Java.
For Java, I would recommend it for the huge amount of resources you can find online, but to be completely honest, I hate some of the decisions Oracle took in the last years which pushed me away from Java.

That said, I don’t think that Java and C# have such big differences. Maybe start to look into both and see which one of them you think you like the most :slight_smile:

@clevadani I vote for Java. However, you could learn both.

Both languages are very similar, it shouldn’t be too hard to learn one of them after you’ve learned either. I am currently learning C# and ASP.NET, but that’s because in my job the backend is built with ASP.NET and I want to work on that. Besides in my area there plenty of opportunities for ASP.NET developers and I follow the opportunities. But opportunities-wise, Java is very reliable, there are probably more jobs for Java developers than any other language, so you can’t go wrong by learning Java.

I think it’s best to learn Java

Java Versus C#: Major Differences

Platforms: Java supports multiple platforms and is open-source, whereas C# is new at supporting multiple platforms and mostly used in development on the Microsoft platform.
Generics: Java has erasers for implementing generics and casts are added upon compilation into bytecode. C# has a slight performance gain over Java as it has integrated it into CLI which allows type information to be available at runtime.
Delegates: C# has delegates, but Java has no built-in delegate feature.
Exceptions: Java has only two types of exceptions: checked and unchecked, while C# has only one exception.
Polymorphism: In Java, it is by default while C# invokes it by virtual and override keywords.
Java is a great option for building complex web-based, highly concurrent application whereas C# is ideal for game development, mobile development. Java is heavily used for building a complex application in an open source ecosystem whereas C# is mostly used to develop an application for Microsoft platforms.
Syntactically both languages are almost the same. A C# developer can easily relate with code written in Java and vice-versa.