[header] How to compare strings in java [title] Create two string objects. [step] The simplest way to declare two strings in java is to use the following code. " string " is the declaration of the object type. 
String1 and string2 are the names of each string. The words, " hello " and " father, " are essentially the values of the string objects.