PRM392Xuất hiện trong 1 đề thi
Consider the following code snippet: String[] result_columns = new String[] {KEY_ID, COL1, COL2}; Cursor cursor = myDatabase.query(true, DATABASE_TABLE, result_columns, null, null, null, null, null, null); Which of the following prints out the values of the COL1 column correctly if the result is not empty?
Các lựa chọn
Aif (cursor.moveToFirst()) { do { System.out.println(cursor.getString(1)); } while (cursor.moveToNext()); }
Bdo { System.out.println(cursor.getString(0)); } while (cursor.moveToFirst());
Cif (cursor.moveToFirst()) { do { System.out.println(cursor.getString(0)); } while (cursor.moveToNext()); }
Dif (cursor != null) { do { System.out.println(cursor.getString(1)); } while (cursor.isNull()); }