Java and C are both imperative languages (Imperative Language). The difference is that Java has object-oriented (OO) components in it, while C is completely process-oriented. C’s high-level Version C and C# support object-oriented.
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 instructions in the system, 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 release 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.
php Chinese website, a large number of free Java introductory tutorials, welcome to learn online!
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!