check which string is lexicographically smaller code example Example: lexicographically greater string java s1.compareTo(s4)