Java tutorial
public class Main { public static void main(String[] args) { String apple = new String("Apple"); String orange = new String("Orange"); System.out.println(apple.equals(orange)); System.out.println(apple.equals(apple)); System.out.println(apple == apple); System.out.println(apple == orange); System.out.println(apple.compareTo(apple)); System.out.println(apple.compareTo(orange)); } }