Fix up the C++ and Java examples to conform to prevailing style.