Java - Write code to convert Y to Boolean

Requirements

Write code to convert Y to Boolean

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str = "book2s.com";
        System.out.println(toBoolean(str));
    }/*from w w  w  .  j a v a  2  s  . c o  m*/

    public static boolean toBoolean(String str) {
        return str.equalsIgnoreCase("Y");
    }
}