android - What does this Java return statement mean? -
android - What does this Java return statement mean? -
am looking on snippets of code , have come across homecoming statement i've never seen before. mean?
return checkdb != null ? true : false;
here's whole method code, reference:
private boolean checkdatabase(){ sqlitedatabase checkdb = null; try{ string pathtodb = dbpath + dbname; checkdb = sqlitedatabase.opendatabase(pathtodb, null, sqlitedatabase.open_readonly); }catch(sqliteexception e){ //database does't exist yet. } if(checkdb != null){ checkdb.close(); } homecoming checkdb != null ? true : false; }
the same return checkdb != null
?:
"ternary operator" which. example: a ? b : c
same method body: { if(a) { homecoming b; } else { homecoming c; } }
java android
Comments
Post a Comment