bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/Java/Java Tutorial
Java•Java Tutorial

Java Non-Primitive Data Types

Non-Primitive Data Types

Non-primitive data types are called reference types because they refer to objects.

The main differences between primitive and non-primitive data types are:

  • Primitive types in Java are predefined and built into the language, while non-primitive types are created by the programmer (except for String ).
  • Non-primitive types can be used to call methods to perform certain operations, whereas primitive types cannot.
  • Primitive types start with a lowercase letter (like int ), while non-primitive types typically starts with an uppercase letter (like String ).
  • Primitive types always hold a value, whereas non-primitive types can be null .

Examples of non-primitive types are Strings , Arrays , Classes etc. You will learn more about these in a later chapter.

Previous

Java Data Types Example

Next

Java var Keyword