The difference between c and java is: 1. Java has object-oriented OO components in it, while C is completely process-oriented; 2. Java is cross-platform, and different operating systems can interpret Java through the JVM Programs, while C, C, and C# are platform-dependent, and some instructions can only be executed in certain operating systems.
[Related learning recommendations: java basics】
The difference between c and java is:
Java and C are both imperative languages (Imperative Language). The difference is that Java has an object-oriented (OO) component. Inside, while C is completely process-oriented, advanced versions of C, C and C#, support object-oriented programming.
Another difference is that Java is cross-platform, and different operating systems can interpret Java programs through the JVM, while C, C, and C# are platform-related, and some instructions are only available on certain operating systems. to be executed. The specific reason is that Java is an interpreted language, and all codes will be translated into unified, system-independent bytecode, and then run on the JVM; while C is a compiled language, and the code must first be converted into system-related bytecode through the compiler. intermediate code before it can be run.
Another difference is that Java does not support system calls and cannot interact with the operating system. This is determined by its cross-platform characteristics.
While C can call the system Instructions such as fork(). This is why there is only the concept of thread (Thread) in Java but not the concept of process (Process), while C has both.
Furthermore, Java cannot control memory, while C can artificially allocate memory through pointers.
Another point is that Java has a Gabbage Collection mechanism that can automatically reclaim space that is no longer used, while C uses the free()
function to free up space.
In general, Java is easier to get started and faster to learn, but it is not as helpful as C for understanding programming languages.
Related learning recommendations: C language tutorial video
The above is the detailed content of What is the difference between c and java. For more information, please follow other related articles on the PHP Chinese website!