Write code to return default String if the string parameter is empty
//package com.book2s; public class Main { public static void main(String[] argv) { String str = "book2s.com"; System.out.println(defaultString(str)); }/*from w w w .java 2 s . c om*/ public static String defaultString(String str) { return str != null ? str : ""; } public static String defaultString(String str, String defaultStr) { return str != null ? str : defaultStr; } }