/*
This program illustrates the use of strings in Java.
Aditya Mathur. January 14, 2019
*/
public class Strings {
 public static void main(String[] args){
     String firstName, lastName;
     firstName="Donald";
     lastName="Knuth";
     System.out.println(firstName);
     System.out.println(lastName);
     // Catenate strings.
     String fullName=firstName+" "+lastName;
     System.out.println(fullName);
     //Find length of the full name.
     int length=fullName.length();
     System.out.println(length);
     /* Better way to print.
         Convert int to String and concatenate
         catenate with a message.
      */
     String display="Name length: "+ Integer.toString(length);
     System.out.println(display);
     // Compare two strings
     String anotherName="Donald Knuth";
     boolean same=fullName.equals(anotherName);
     System.out.println(same);
     String yetAnotherName="Albert";
     same=fullName.equals(yetAnotherName);
     System.out.println(same);
 }
}
