Non primitive data types simply said user defined datatype, because primitive datatype already assigned values. ex : int, float are have predefined size and range values. but, non primitive is a class (template or blueprint) it has object.
The non primitive datatype (class) have objects. The object represent class. Object is a combination of state and behaviour. In detail, class is a template (phone) and it contain object (like display ,RAM , camera etc).
In this case we have some confusion between class and object, because phone is a object(real time entity). why we said it’s a class. The reason is we decide the phone is a class while write a program and it contain objects like RAM, CAMERA, SPEAKER,MIC ETC. For instead RAM has state (mega pixels) and behaviour ( photo , video)
Variable: it represent primitive data type it contain only values, new keyword is not needed , size is fixed.
Object: it represent class.it can contain values and behaviours. New keyword is needed for allocating memory. Size is not fixed(dynamic).
Ex: class name: car ,reference name engine, new (allocate memory for object creation),
car engine=new car(); car gear= new car(); car steering= new car();
Class have rules: meaningful name,shouldn’t not be verb. Should start with capital letter. No special characters allowed except underscore ‘_’ . shouldn’t start with numbers.no space is allowed. Should follow camel case .ex :ActivaBikeFromHonda
Ex: reference image from site http://www.scientecheasy.com
