Write a code segment that prints the longer of the two strings name1 and name2. Print them both if they have the same length.
if (name1.length() >= name2.length())
System.out.println(name1);
if (name1.length() <= name2.length())
System.out.println(name2);