The difference between Java and C language is as follows:
1. C language is a process-oriented language with high execution efficiency; Java is The execution efficiency of object-oriented language is lower than that of C language;
2. C language is not as safe as Java. C language does not have Java's garbage collection mechanism, and the applied space must be released manually. Java has good versatility and can be directly transplanted across platforms, as long as the Java Virtual Machine (JVM) is installed.
3. In terms of speed, programs written in C language are better than Java
4. C language focuses on algorithms, but Java is different. You can just import the package when you want to use it. . Algorithms in C language are very important, but algorithms in Java are not as complex as C language.
5. Java uses the Unicode character set, and C language usually uses the ASCII character set, A-65, a-97.
6. C language variables do not need to be initialized, but Java variables must be initialized.
7. Different application fields:
C language is mainly used for driver development, operating system, kernel development, development of embedded (single chip microcomputer), switches, routers and other network equipment; Java is mainly used for Enterprise application development, including server-side development, embedded fields, big data technology, website fields, etc.
8. Dynamic and static binding
In C language, in order to allow the runtime to dynamically determine which function is called, a function must be decorated with virtual. The virtual keyword is automatically inherited to support polymorphism; all member functions (including static) that are not modified with virtual are statically bound, that is, which version to call is decided at compile time
And in Java , except static, final, and private which are static binding, all methods are processed as dynamic binding
Recommended learning:C language video tutorial
The above is the detailed content of What is the difference between C language and java?. For more information, please follow other related articles on the PHP Chinese website!