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 object data types - Java Tutorial
From the course: Java 8 Essential Training
Working with object data types
- So far, I've described variables in Java that use the primitive data types: numbers, characters, and booleans. But there's a whole other category of Java variables that are references to objects. An object in Java is an instance of a Java class. When you create a variable, and you point it at an object, the variable isn't the object itself. Instead, it's simply referencing the object. And you can actually have multiple reference variables that are pointing to a single object in memory. So, you might declare an object that has a name of anObject, and then you might have three different variables that are all pointing to the same thing. If something changes about that object in memory, all three of those variables would update. Here's an example: let's say that I've defined a Java class. This class is named ClothingItem, and I've declared a string variable that's a member of the class. Notice that this string variable doesn't have the word static. That means it's something called an…
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)
Working with object data types6m 27s
-
Using the String class5m 5s
-
(Locked)
Converting primitive values to strings4m 15s
-
(Locked)
Building a string from multiple values8m 44s
-
(Locked)
Comparing string values5m 51s
-
(Locked)
Formatting numeric values as strings4m 41s
-
(Locked)
Parsing string values3m 13s
-
(Locked)
Working with dates and times8m 35s
-
(Locked)
Challenge: Creating a simple calculator application1m 28s
-
(Locked)
Solution: Creating a simple calculator application1m 19s
-
(Locked)
-
-
-
-
-
-
-
-