java - Can new File() constructor return null on Android? -
i saw code in android training center website:
boolean hasexternalstorageprivatefile() { // path file on external storage. if external // storage not mounted fail. file file = new file(getexternalfilesdir(null), "demofile.jpg"); if (file != null) { return file.exists(); } return false; }
does mean on android new file()
can return null?
no, constructor may never return null. constructor either returns initialised object or throws exception or error.
Comments
Post a Comment