I get the error statement "Error: Incompatible type: String [] cannot be converted to String" at retur Con ;, but I don't know the cause.

public static String findtest (SQLiteDatabase db, int id) {
        String sql = "SELECT name age FROM test WHERE _id =" + id;
        Cursor cursor = db.rawQuery (sql, null);
         String Con [] = new Con [1];
        while (cursor.moveToNext ()) {
            int cul1 = cursor.getColumnIndex ("name");
            int cul2 = cursor.getColumnIndex ("age");
            Con [0] = cursor.getString (cul1);
            Con [1] = cursor.getString (cul2);
        return Con;
  • Answer # 1

    The cause is that the array of String is returned even though the return value is String.

  • Answer # 2

    String Con [] = new Con [1];

    In the first place, this line should cause an error.
    I don't know who the Con on the right side is, but since String is a final class and cannot be inherited, it should be impossible to insert an array of a different class called Con.
    In other words, "symbol not found" or "incompatible type" should appear in this place, so the premise of the question is strange.