Write code to Check if a string is correctly set.
//package com.book2s; public class Main { public static void main(String[] argv) { String toCheck = "book2s.com"; System.out.println(isStringSet(toCheck)); }/* w w w.j a v a 2 s. co m*/ /** * Checks if a string is correctly set. In particular this methods return * true iff toCheck is not null and the content is not equal to the string * NULL * * @param toCheck * @return true iff the given string is not null and the content is not equal to NULL */ public static boolean isStringSet(String toCheck) { return toCheck != null && !toCheck.trim().equalsIgnoreCase("NULL"); } }