I’m trying to set an Array only if it doesn’t exist but I cannot figure out how to do it since I get an error saying it doesn’t exist:
if (null == arr) { // arr cannot be resolved to a variable
arr = new ArrayList<task>();
}
Isn’t there something such as isset() from php? Also what does <> hold?
No, you can not.
Javais the language with strong static typing. There isn’t anyissetlike inJS.The only way is to
declareyour variablearrbefore and assignnullvalue to it.