String str1 = null; String defaultStr1 = "default"; String result1 = StringUtils.defaultIfBlank(str1, defaultStr1); System.out.println(result1); // Output: default
String str2 = ""; String defaultStr2 = "default"; String result2 = StringUtils.defaultIfBlank(str2, defaultStr2); System.out.println(result2); // Output: default
String str3 = "hello"; String defaultStr3 = "default"; String result3 = StringUtils.defaultIfBlank(str3, defaultStr3); System.out.println(result3); // Output: helloIn this example, the resulting string is "hello" because str3 is not blank or null. The package library for org.apache.commons.lang StringUtils is Apache Commons Lang.