From the course: Java 8 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Working with primitive variables

Working with primitive variables - Java Tutorial

From the course: Java 8 Essential Training

Start my 1-month free trial

Working with primitive variables

- As with nearly all programming languages, Java supports the use of variables to store data in memory. There are two major classes of variables or data types in Java, known as primitives and objects. Primitive variables or data types are used to store numbers, individual characters and boolean values. They're stored in the fastest available memory, so you can get to the data as quickly as possible. Data type names for primitives are all in lowercase and that's how you can distinguish them from complex object data types, which always have an initial uppercase character. Most of the simple values you might store in Java code are primitives. But one data type that's absolutely not a primitive is a string. That's a complex object. All variables in Java, whether primitives or objects, must be explicitly data typed when they are declared. Java is a statically typed language and that distinguishes it from dynamic languages such as JavaScript or Python. All variables must have their types…

Contents