Java - Write code to check if two string values are equal

Requirements

Write code to check if two string values are equal

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str1 = "book2s.com";
        String str2 = "book2s.com";
        System.out.println(equals(str1, str2));
    }/*from   w  w w.  j  a  v  a  2  s.c om*/

    public static boolean equals(String str1, String str2) {
        if (str1 == null) {
            return str2 == null;
        }

        return str1.equals(str2);
    }
}