java和C++是很相似吗

没错。语法上很多地方受了 C++ 影响。当然后来 C++ 也从 Java 反哺了比如 ranged-for 语法。见《The Java Language Environment》里的设计目标部分(1.2.1)Even though C++ was rejected as an implementation language, keeping the Java programming language looking like C++ as far as possible results in it being a familiar language, while removing the unnecessary complexities of C++. Having the Java programming language retain many of the object-oriented features and the "look and feel" of C++ means that programmers can migrate easily to the Java platform and be productive quickly.


    推荐阅读