What is a String?
A String is a type of variable that is used to represent a sequence of characters. It’s not one of the eight primitive types; it is an object. You can declare, initialize, and assign strings in the same way as you would work with other variables.
Behind the scenes, a String is just a fancy way of storing an array of characters. If you really needed, you could make your own String class. But since storing text is so common in program, Java created this built-in object for our convenience.
When comparing Strings, you will almost always want to use the .equals() or .equalsIgnoreCase() methods. These methods check the contents of two Strings and check if they are the same. For example
System.out.println("Waffles are far superior to pancakes. Good decision.");
You want to avoid using the == operator with Strings. What this does is actually compare the memory addresses of two Strings. This is rarely the behavior you're looking for.