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 - Java Tutorial
From the course: Java 8 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Working with primitive variables8m 4s
-
Declaring and initializing numeric primitives6m 14s
-
Representing currency values with BigDecimal5m 10s
-
Converting numeric values5m 37s
-
Using mathematical operators and the Math class6m 1s
-
Working with Boolean values and expressions4m 49s
-
Working with character values3m 23s
-
Using Java operators6m 11s
-
-
-
-
-
-
-
-
-
-