I'll pull out the Art of War here. "If you know yourself and you know your enemy, you will be ever victorious."
Learn the differences between each of the languages and approach the problem. Then the answer will just jump out at you. If the problem is best handled via object-oriented design, then Java or C++. If development speed is needed, I find java code to be more intuitive. But if you need to do direct memory access operations, then C++ will be better off. If it's a fairly simple parsing, you can use regex or a scripting language. If it's a simple recursion problem, OCaml might be the cleanest way to write the code.