what is difference between the structure of c++ and java?

2008-07-11 4:33 am

回答 (3)

2008-07-11 5:24 am
✔ 最佳答案
Java and C++ are both members of the "C family" of languages, and their syntax is quite similar. C++ strives to add objects to C, and does so fairly well. Java is also object-oriented, but deliberately does less than C++ (such as multiple inheritance of stateful classes) to reduce complexity. Being a newer language, Java is a "better" OO language than C++ in some ways. Java is a bit more strongly typed than C++. C++ compiles to executable code; Java to "bytecode" that must then be interpreted by a virtual machine.
2008-07-11 4:58 am
Being 2 different languages, of course syntaxes and reserved keywords are different. However, the fundamental difference comes from the nature of the 2 languages.

Java is a 100% object-oriented language, codes are run on the Java Virtual Machine (you can image that as a sandbox), while C++ is a hybrid language with the codes compiled and run directly under the OS kernel.

In terms of programming principles, everything has to be declared and work as class object in Java. In C++, you can have primitive data scattered all over the places and have all of the procedural parts mixed with the object-oriented stuffs.
2008-07-11 4:39 am
dif. syntax methods and events. lol

they both have #include and isostream.h

and this

}{
they just have differant features to allow differant things.


收錄日期: 2021-05-01 01:02:50
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080710203359AA2GVBJ

檢視 Wayback Machine 備份