• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between Primitive & non-primitive data types?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody please tell me what is the difference between Primitive & non-primitive data types?
 
Ranch Hand
Posts: 257
Hibernate Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Those which are all not classes are defined as primitives. The primitives does not have a class defined.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Amol,
everything in Java is an object except primitives data types.
So primitives are not objects!
There are 8 types of primitives data types in Java. The are defined by the language specification, that is, you cannot add/create your own primitives data type (while, you can create new objects)
Data types are used to represents numbers (both integers and floating point), chars (which internally are treated as numbers) and boolean (true - false).
I think you'll find really useful this link:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html

Bye Manio
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
primitives are basically sequence of bytes and non premitive are object references.While serializing also the premitives data types are copied to the stream byte by byte.Unlike C or C++ the size for all the premitives are fixed for all JVM's.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic