method to compare two strings lexicographically. code example Example: lexicographically greater string java s1.compareTo(s4)