Within a software engineering point of view, Java seems to be the more robust programming language among Java/C++. The language catches some of the ugly design and implementation features that C++ offers. The memory management based on garbage collection makes code more robust and might allow faster development. Concerning highly optimized code, C++ may be the choice.
The main difference between c++ and java is that 'C++ does not allow persistence because it does not support database connection while Java allows persistence because it supports database connection'.
Major Broad differences between Java and C++ are: 1. Portability - C++ sources are required to be compiled for a particular system, to execute on that system only, whereas Java compiles to a byte code which just needs a JVM (Java virtual machine), and hence, can run the byte code compiled for any platform. 2. Memory management - C++ programing expects programmers to manage the memory allocated on heap using new and delete(), whereas Java handles the memory cleanup itself internally. Java programmer does not need to worry about freeing up any memory allocated. 3. Organization - C++ generally have individual classes which can be included in namespaces in case of same class names, however Java classes work in packages i.e. each Java class must be a part of a package and each class is identified by its package. i.e. absolute class name would include the package name. 4. UI - In general Java is considered better and efficient for UI handling. There might be many other differences, but above mentioned are the major ones as far as I've come across.
Java is platform independent language and C++ is not moreover Java does not support type definition or pre processor. Java supports classes which PHP doesn't.