From the course: Learning Java 11
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Strings in Java
- [Instructor] So far, we've learned about a few data types. These data types, int, Boolean, double, char, were primitive types. These are great for storing a whole number, true/false values, a single letter or symbol, but what if you wanted to store and reference some text, something that requires more than just a single character? In this lesson, we'll be looking at the second overarching category of Java data types called reference types. And our first reference type is called a string. A string is a sequence of ordered characters. Before, we could represent a single character with a char, but now we can represent a word or a person's name with the string data type. To create a string, we surrounded the series of characters with quotation marks. This represents a string value. To create a string variable, we just state the data type string, give the variable a label, and then use the assignment operator to assign the variable the string value. We should also note that the order of…
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.