There are many similarities in the syntax of Java and C, but there are many differences.
One, the difference in the initial value
In the C language, it can be used without initialization.
In Java, the value must be initialized.
Two, the difference between abstract methods or abstract classes
The equivalent syntax of C language is "pure virtual function" and "abstract class"
Java uses the abstract keyword to modify a method or abstract class, and the final class cannot be inherited
Use abstract classes as base classes in an inheritance hierarchy, provide generic concepts, implement their abstract methods by subclasses, and abstract classes cannot be directly instantiated as objects
E.super The difference between keywords
The JAVA super keyword, which refers to the parent class object, is often used to call the parent class's constructor or general method
C language does not have super keyword
Third, data types and classes
Java is a fully object-oriented language, and all functions and variables must be part of the class. In addition to the basic data types, the rest are used as class objects, including arrays. Objects combine data and methods to encapsulate them in a class so that each object can implement its own characteristics and behavior. C + + allows functions and variables to be defined as global. In addition, the structure and union in C + + is removed in Java, eliminating unnecessary hassles.
Four, string
C does not support string variables, using a null terminator in a C program to represent the end of a string, in Java, strings are implemented using class objects (STRINR and StringBuffer), which are the core of the Java language, with the following advantages of implementing strings with class objects:
(1) The method of establishing strings and accessing string elements is consistent throughout the system;
(2) J3 the string class is defined as part of the Java language, not as an additional extension;
(3) Java string execution run-time check-out to help troubleshoot some runtime errors;
(4) The string can be connected by "ten".
201671010139 2016-2017-2 syntax differences between JAVA and C languages