C++ vs Java

Key Differences

Aspect C++ Java
Speed Higher peak performance as has more predictable latency Less wrt C++ because of unpredictable Garbage Collector Pauses
Risks allocation and deallocation, and incorrect manual ownership can cause leaks, use-after-free bugs Fewer memory-lifetime errors
Use cases Applications that need smaller memory & more control over HW/Memory
  OS, device drivers, firmware, embedded systems, Games, Robotics, Graphics
Memory & Speed is not major issue, but system should be stable
  Large enterprise applications, distributed systems, Andriod