Write code to compare two string for equal and handle null value
//package com.book2s; public class Main { public static void main(String[] argv) { String a = "book2s.com"; String b = "book2s.com"; System.out.println(equals(a, b)); }//from www. j a v a2s . c om public static boolean equals(String a, String b) { if (a == null || b == null) { return false; } if (a.isEmpty() && b.isEmpty()) { return true; } return a.equals(b); } }