I have studied about java datatype very earlier and found that they are primitive type. As java is object oriented but its data types are not. why is it so?
It is said that everything in Java is an Object at the same time the Java Programming Language is meant to be simple. Since the primitive data types consume less memory and can be accessed faster, they are not objects. The equivalent Wrapper classes are also available in java like "Integer" "Short" etc. They can be used as objects if you want. However, the wrapper classes will be stored in Heap and they are slow.
It is more efficient to deal with primitive types than making each variable a full fledged object. The most common types (ie. int, char, float etc.) are simple primitives. The rest are objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With