Brief Overview & Comparison of Object-Oriented Programming from C to Java
Through C, you will understand the concept of Polymorphism, Inheritance, Encapsulation, Class, Objects, etc. As you also know C language don’t support OOP, but we can understand the concept behind it by defining a fine structure as a Class and Creating its Identity as an Object.
In Parallel, through Java, we can understand how it really works with actual Class & Object.
From this Comparison, we get the ability to think of Logic behind Object-Oriented Programming.
Understanding the Concept behind the Comparison
|Class in java (example Customer)||A Structure created in C (example customer)|
|Fields of the Class (example int id, String name)||Variable present in Structure (example int id, char* name)|
|Constructor present in Class||Function created and returning a pointer which is storing the data in heap memory (Example cust* createCustomer)|
|Method of the class (Example printCustomer)||Function created (Example printCustomer)|
|Creation of Object form the Class in Java||Create an instance of struct customer|
The Id is 25 The name is Siddharth
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.