String
Know how to declare and initialize a String variable.
Know how to check for String equality.
Know how to join one or more String values to form a single String.
You can just declare a String variable with a type and name:
String title;Then later in your code you can initialize it to hold a value:
title = "Java - The Complete Reference";Or you can declare and initialize it all in one line of code:
String title = "Java - The Best Language";To test if a String variable contains a particular value, you need to use the equals or equalsIgnoreCase method:
password.equals("password") school.equalsIgnoreCase ("The League")To join Strings together, you can use the + operator:
String greeting = "Hello "; String name = "Bob"; System.out.println(greeting + name);The above code would pring "Hello Bob" to the console.