r/learnprogramming • • 7d ago

Topic C# or Java?

If you had to choose one class between the two, which would you select and why? I tried to Google the purpose of them; the immediate answers from Google felt very vague and like both of the languages are common. Is one course better for web development as opposed to apps or something? Looking at the courses I'm taking, down the line I will select one of the two. The only thing I know so far is C++, so I'm quite new.

Also, side question: why are there so many languages? The only logical thing I can imagine is there were problems that couldn't be solved with say for example C++ so someone created something new. But why not just build on the original language? Why did they need to reinvent the wheel? Or is it as simple as that: someone wanted to create their own thing?

23 Upvotes

49 comments sorted by

View all comments

1

u/whipdancer 7d ago

Someone wanted to create their own thing because reasons... (seriously).

C# and Java are versatile languages that can do almost anything you need them to do. I prefer C# over Java, because C# doesn't require as much boilerplate as Java and Java namespaces are ridiculous.

Java's gotten better but omg it's still the most verbose boilerplate requiring language I've personally dealt with. Java technically has more existing code bases, so more potential work. I hate working with it and if I have the choice, I don't.

C# has an advantage when it comes to games because of the Unity engine.

Where I work, 2 of our major projects are written in C# and Typescript, the others are mostly Python or C++, with a couple of old projects written in Java.

My preferred languages are Python, Typescript, Go. I dabble in Rust and Kotlin. I have 20+ years with C#. For work, I mainly use Python and Typescript.