c++ and java comparison