Write code to compare two string for equality using nested if statements
Check reference and verify null value.
Use nested if statements.
//package com.book2s; public class Main { public static void main(String[] argv) { String l = "book2s.com"; String r = "book2s.com"; System.out.println(equals(l, r)); }/*from www.j av a 2s .com*/ public static boolean equals(String l, String r) { if (l != r) { if (l != null || r != null) { return l.equals(r); } return false; } return true; } }