Java - Write code to compare two string for equal Ignore Case using conditional operator

Requirements

Write code to compare two string for equal Ignore Case using conditional operator

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String target1 = "book2s.com";
        String target2 = "book2s.com";
        System.out.println(equalsIgnoreCase(target1, target2));
    }/*w w w.jav a2s .  c o m*/

    public static boolean equalsIgnoreCase(final String target1,
            final String target2) {
        return (target1 == null) ? (target2 == null) : target1
                .equalsIgnoreCase(target2);
    }
}

Related Exercise