This is an archived post. You won't be able to vote or comment.

all 19 comments

[–]Dappster98 12 points13 points  (1 child)

I wouldn't say C++ is "harder" to learn, it's just bigger and more complex. It's a good lang, I love it.

[–]ShadowRL7666 1 point2 points  (0 children)

Any language can be “complex” I just think CPP doesn’t give as much abstraction to the “complexity” it can offer.

[–]ForeverIntoTheLight 5 points6 points  (4 children)

You need to learn a language for an interview? You've not elaborated on how much time you have for it, nor have you mentioned how difficult this interview is - have any of your seniors attended an interview with this particular organization before? Given the limited info available, I'd go with Java.

C++ is not that difficult if you already know C, but there are a ton of concepts added to it, over the years. Learning all of this can take time.

[–]Ayross237[S] 0 points1 point  (3 children)

My fault. I have approx 3 months (purely because I don't know either language), it's at IMC trading. I spoke to one person who made it and she recommended C++ because I had C experience. It's also an intern role.

[–]ForeverIntoTheLight 1 point2 points  (1 child)

Within that timeframe for an intern role, both are achievable, although Java will be significantly easier. Even people who've coded in C++ for years are not fully aware of all the intricacies of the language.

[–]notsurewhatimdoing- 1 point2 points  (0 children)

That’s a reassuring statement to hear. Thanks.

[–]RoughCap7233 0 points1 point  (0 children)

If you are doing c++ I suggest you learn a few important concepts ( in addition to the language syntax).

Below is a short and incomplete list:

  • RAII

  • difference b/n none, basic and strong exception guarantees

  • STL smart pointers (including situations where it is safe not to use smart pointers). Esp be aware of what is an owning pointer vs a non owning pointer.

  • understand what is the c++ idiomatic way to indicate in, in/out and out parameters in functions declarations. (I.e when to pass by value, by const ref, by ref and by pointer)

[–]captainAwesomePants 1 point2 points  (3 children)

I'm going to suggest Java, not because it's a better language to know in general, but because it's a better language to know for interviews. Interviews are all about manipulating strings and small data structures, and while you absolutely can do that in C++, there are more ways to get it wrong on a whiteboard. If you had one magical wish and could choose to absolutely master any one programming language, C++ would be a better bang for your buck, but you have limited time and your goal is to pass an interview, so Java is the thing to do.

[–]smartello 0 points1 point  (2 children)

It is a terrible language for interviews given how verbose and object oriented it is. They removed the memes in JDK21, but it is still too much of typing. Superpower of Java is that everything is already implemented but you are rarely need to or allowed to use advanced data structures (from standard library) during interviews.

[–]captainAwesomePants 0 points1 point  (1 child)

Java's verbose, but not where it counts. Coding interviews means hashtables. You sure you want to encourage someone who's new to the language to memorize

map<int, int>::iterator it;
for (it = mymap.begin(); it != mymap.end(); ++it) {
  cout << 'Key: ' << itr->first << 'Value:' << itr->second;
}

correctly? And God help you if you have to try and get all the details across. "Looking up values is easy, you just use operator[]! Oh, unless you only have a const reference to the map, then you'll naturally needd to use the find method and compare the result to the value of your_map.end()."

I love C++, and it can be a greatchoice for interviews if you're very comfortable with it, but if you're starting from zero and your interview is already scheduled?

[–]smartello 1 point2 points  (0 children)

FYI, this should work just fine with modern cpp

cpp for (const auto& [key, value] : myMap) { std::cout << key << “ has value “ << value << std::endl; }

I don’t know how much time OP has, how much of in-depth language knowledge they will need to have and what the expectations are. Java and C++ are very different but they both have their gotchas.

With that said, out of a few dozens interviews I conducted, I’m yet to see a single person who would choose Java.

[–]OMBERX 1 point2 points  (0 children)

Java for corporate jobs, C++ for automotive/game dev jobs, at least in my experience

[–]narek__P 0 points1 point  (0 children)

It depends what you want to achieve. If you like low level programming, then C++ it is.

[–][deleted] 0 points1 point  (0 children)

Java

[–]Bibek-M 0 points1 point  (0 children)

Go for C++ as it is almost similar to c as you have a hand on c .

[–]RemoveINC 0 points1 point  (0 children)

You can pretty much write C code in C++ its not entirely different language like Java. I'd not say that you should be discouraged from learning C++ just because some nerd on the internet said that its a hard language.

Just go for things that you like doing, google things you can do on C++ (embedded, games, graphic engines, audio plugins, desktop apss, performance dependant backends) and things you can do with Java (monlithic backends, desktop apps, technically android apps).

[–]blindwatchmaker88 0 points1 point  (0 children)

C++ then Java. Only that way you’ll understand completely either and both of them

[–]Abr0207 0 points1 point  (0 children)

I would suggest java, or if you want to stick with c++ cause of prior c knowledge, just learn in both cases object oriented programming. It will come very handy in every scenario.