*
The moose likes Beginning Java and the fly likes Difference between Primitive & non-primitive data types? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between Primitive & non-primitive data types?" Watch "Difference between Primitive & non-primitive data types?" New topic
Author

Difference between Primitive & non-primitive data types?

Amol Patil
Greenhorn

Joined: Aug 30, 2004
Posts: 8
Can anybody please tell me what is the difference between Primitive & non-primitive data types?
Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257

Hello,

Those which are all not classes are defined as primitives. The primitives does not have a class defined.
Manio Manegra
Greenhorn

Joined: Sep 15, 2006
Posts: 8
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
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
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.


Rahul Bhattacharjee
LinkedIn - Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Difference between Primitive & non-primitive data types?
 
Similar Threads
Primitive Data Types
Find the data type of a variable
wrapper classes
is Date a datatype ????
parseXXX vs valueOf In Primitive Type Wrapper Classes