Do I need to learn C language first to learn Java?
No, Java is an object-oriented language and C is a process-oriented language. Language, the reason why some people choose to learn C first and then Java is mainly because Java and C have many syntax similarities. If you get started with C language, learning Java will be easier.
The difference between Java and C
Java and C are both imperative languages (Imperative Language), different Java has an object-oriented (OO) component in it, while C is completely process-oriented. The advanced versions of C, 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.
Recommended tutorial: "Java Tutorial"
The above is the detailed content of Do you need to learn C language first to learn Java?. For more information, please follow other related articles on the PHP Chinese website!