![]() |
|
Java Data Types, Free online Core Java Programming Tutorial, Learn Java Programming Language online for free... |
| Lessons | Java Data Types |
|
||||||||||||||||
|
Primitive Types Primitive data types are generally used for local variables, parameters and instance variables (properties of an object). Primitive data types are located on the stack and we can only access their value, while objects are located on heap and we have a reference to those objects. Also, when invoking methods in java, primitive data types are always passed by value and objects are always passed by reference. All the primitive types have specified sizes that are machine independent for portability.
Reference Types Arrays and objects of classes are the examples of Java reference types. Arrays and classes are discussed in the coming lessons. There are no struct, union, enum, unsigned, typedef, or pointer types in Java.
Next >>> Lesson No. 4: Java Arrays vs C++ Arrays
|