User Defined Data Type – Class – in Java | Core Java Online Training

This Core Java Online Training “User Defined Data Type – Class – in Java” post explains clearly what is the difference between structure and class in C and Java languages.


 

User Defined Data type :

  • Class is extension to structure in C / C++
  • Structure is used to allocate memory to different kinds of data elements.
  • After allocating memory to a structure, we can collect the address into a variable of structure type.
  • Structure variable is “internal pointer variable”, because it holds address.
  • We can access structure elements using dot(.) operator.

User Defined Data type in Java

 

Example Code :

 

Share this