Posted On: Jan 02, 2019
Primitive: Primitive Data Type is a type of data in Java which is simple in nature and is suitable for the base architecture of all the operations of computer like int, float, pointer, etc. and also all the possible variations of them such as char, short, long, signed, unsigned, float double, etc. They are not able to possess additional capabilities. Moreover, they are only single values and not the complex ones. Some of the examples of primitive data types can be given by byte, short, int, long, float, double, char and many more. There are some primitive data structures in the library too.
Some of the primitive data structures consist of integer reals, logic data character, pointer, reference, etc. Both primitive data types as well as primitive data structures can be directly controlled and monitored by the machine-level instructions and therefore called the simplest forms of data types and data structures. Primitive data are built-in or it can be said that they are already defined data types. In the world of programming, whenever data type is considered it automatically reflects the primitive data type, not the non-primitive one.
Non Primitive: A non-primitive data type is quite different from that of the primitive data type. It comprises of an array structure or class inside the program. These data types are formed by deriving from primary data types. These commonly consist of a group of values. Some examples of non-primitive data types are array, structure, union, linked lists, stacks, queues, etc. Non-primitive data types are based on class. Another name for these kinds of data types is reference data types or object references.
These cannot be defined using a programming language but in the place of it, the programmer himself defines non-primitive data types. In Java, these are simply known as objects because they are created by the user, not predefined in the library. Non-primitive data types represent a memory location which gives space to store the data. Also, when an object (non-primitive data type) is created, it may contain any type of data, but the information represented by the object will always be stored as a primitive data type.
Never Miss an Articles from us.