From the course: Java 11+ Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Work with primitive variables - Java Tutorial
From the course: Java 11+ Essential Training
Work with primitive variables
- [Instructor] Java is a statically typed language. That means that all variables have types that are set when the variable is declared. And once set, a variable's type can't be changed. There are two major categories of data types in Java, primitives and objects. A primitive variable is stored in the fastest possible memory. These include numbers, single characters, but not full strings, and Boolean values. Primitive types can contain a single value. They're not complex objects, so they don't have members such as methods or fields. The types for primitives are all lowercase. That's how you can recognize them in your code. And they include these, int for interger, char for character, short and long for different kinds of integers, double and float for different sorts of floating values, and Boolean. A string is not a primitive in Java. It's a complex object, an instance of a class, and we'll get to strings later. You…
Contents
-
-
-
-
-
(Locked)
Work with primitive variables5m 43s
-
(Locked)
Declare and modify primitive values3m 27s
-
(Locked)
Declare and initialize object variables3m 40s
-
(Locked)
Manage currency values with BigDecimal3m 8s
-
(Locked)
Convert values between numeric types2m 40s
-
(Locked)
Math operators and the Math class2m 22s
-
(Locked)
Manage true and false Boolean values2m 43s
-
Manage character values as primitives3m 13s
-
(Locked)
More about Java operators5m 45s
-
(Locked)
-
-
-
-
-
-
-