From the course: Nail Your Java Interview
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Understand string equality - Java Tutorial
From the course: Nail Your Java Interview
Understand string equality
- [Illustrator] The roots of string equality lie in how we create an initialized strings. There are two ways we can create strings. We can create string literals or string objects. The difference between these is how they are stored and referenced in our code. Most of the time, you'll likely create a string literal. That's a series of characters with quotes around them. As string literals, both string A and string B refer to the same string in memory. They are both references to the same literal ABC value within the string constant pool. This matters in the case of string equality, which we'll discuss in a minute. The other way to create a string is with the string object constructor. In this case, instead of creating a string literal, we are creating a string object. Object A and object B do not refer to the same string value because they are created as separate objects with the string constructor. Usually, you'll want to…
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
-
-
-
-
-
Concatenate strings with different methods3m 20s
-
(Locked)
Normalize string input4m 13s
-
(Locked)
Access data from strings4m 44s
-
(Locked)
Apply string functions in technical interviews4m 35s
-
(Locked)
Understand string equality4m 2s
-
(Locked)
Solution: Developing a Palindrome Checker3m 49s
-
(Locked)
Solution: Counting with String Manipulation2m 40s
-
-
-
-
-