Comparing Lexicographically Java Code Example

Snippet 1


Snippet 2

  // Java program to show how to compare Strings 
// using library function 
public class Test 
    public static void main(String[] args) 
        String s1 = "Ram"; 
        String s2 = "Ram"; 
        String s3 = "Shyam"; 
        String s4 = "ABC"; 
        System.out.println(" Comparing strings with compareTo:"); 

Copyright © Code Fetcher 2020




Leave a comment

Your email address will not be published. Required fields are marked *