/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main
(String[] args
){ System.
out.
println(withTernary
(null,
null)); //Null Pointer System.
out.
println(withIfElse
(null,
null)); //No Exception }
return val == null ? defVal : "true".equalsIgnoreCase(val);
}
if (val == null) return defVal;
else return "true".equalsIgnoreCase(val);
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbih3aXRoVGVybmFyeShudWxsLCBudWxsKSk7IC8vTnVsbCBQb2ludGVyCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKHdpdGhJZkVsc2UobnVsbCwgbnVsbCkpOyAgLy9ObyBFeGNlcHRpb24KICAgIH0KCiAgICBwcml2YXRlIHN0YXRpYyBCb29sZWFuIHdpdGhUZXJuYXJ5KFN0cmluZyB2YWwsIEJvb2xlYW4gZGVmVmFsKXsKICAgICAgICByZXR1cm4gdmFsID09IG51bGwgPyBkZWZWYWwgOiAidHJ1ZSIuZXF1YWxzSWdub3JlQ2FzZSh2YWwpOwogICAgfQoKICAgIHByaXZhdGUgc3RhdGljIEJvb2xlYW4gd2l0aElmRWxzZShTdHJpbmcgdmFsLCBCb29sZWFuIGRlZlZhbCl7CiAgICAgICAgaWYgKHZhbCA9PSBudWxsKSByZXR1cm4gZGVmVmFsOwogICAgICAgIGVsc2UgcmV0dXJuICJ0cnVlIi5lcXVhbHNJZ25vcmVDYXNlKHZhbCk7CiAgICB9Cn0=