From the course: Java 8+ Essential Training: Syntax and Structure
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Work with primitive variables - Java Tutorial
From the course: Java 8+ Essential Training: Syntax and Structure
Work with primitive variables
- [Instructor] Java has two broad categories of data types. Primitive data types are used to represent simple values such as numbers, characters, and booleans or true/false values. A variable that uses a primitive data type represents a single value. It's not a complex object. When you declare a variable that uses one of these types, you'll start with the type declaration. And you'll know that it's a primitive type because all of the primitive type names are in all lowercase, whereas complex object types are classes, and their initial character is uppercase. So for example, the int, which is an integer, a char, which is a single character, short, long, boolean, and so on, all of these names are all lowercase. On the other hand, the data type String is an object-based type, and so it has an uppercase S to indicate that it represents a class named String. When you declare a variable, you must declare its type. Java is a statically typed language, and on its own, it doesn't have any…
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
-
-
-
-
-
(Locked)
Work with primitive variables6m 35s
-
Declare and modify primitive values4m 48s
-
(Locked)
Store currency values with BigDecimal3m 32s
-
(Locked)
Convert values between numeric types3m 19s
-
(Locked)
Math operators and the Math class3m 11s
-
(Locked)
Work with boolean values2m 51s
-
(Locked)
Work with character values4m 12s
-
(Locked)
More about Java operators4m 48s
-
(Locked)
-
-
-