Float and double both occupy fixed amount of memory irrespective of what number it holds. But String is an object. Memory allocation depends on the content
Above answer was rated as good by the following members: sandeep_14185
The primitive datatypes are nothing but the basic data types..like int char float double etc..Char is a datatype which stores 2 bits of data..String has been derived from Char which takes more number of Char and integers..providing the more memory storage...Its not a primitive coz it is a basic datatype...Its advancement of char..So its not a primitive datatype
As balaji has asked a nice question that why double is a primitive data type as it came from float? As double is the default data type given to the floating point-numbers.Naturally when we declare float f 0;---------the memory occupied to it is double.Inorder to use memory effectively we go for float as float f 0.0f;As double is not a two float.
Float and double both occupy fixed amount of memory irrespective of what number it holds. But String is an object. Memory allocation depends on the content