title: How to extract the cursor and integer value from an array of Object class?
body: <p>I have a method which returns an array of Objects (the father class of all classes in Java). Array contains 2 types of data as you can see <code>objArray[0] is a int;</code> and <code>objArray[1] is a cursor;</code> </p>
  
  <pre><code>public Object[] search_record(String rollNo) {
  
      Object[] objArray = new Object[2];
  
      SQLiteDatabase db = this.getWritableDatabase();
  
      Cursor cur = db.rawQuery("SELECT * FROM " + TABLE_NAME
              + " where roll_no = ?", new String[] { rollNo });
      int count = cur.getCount();
  
      objArray[0] = count;
      objArray[1] = cur;
  
      Log.i("Records count", count + "");
  
      return objArray;
  
  }
  </code></pre>
  
  <p>Now I am unable to extract these values back in the original values <code>i.e int and cursor</code>. I'm getting the array like this.</p>
  
  <pre><code>Object[] objArray = dbHelper.search_record("08cs18");
  int x = ((Integer) objArray[1]).intValue();
  Cursor cursor = (Cursor) objArray[0];
  </code></pre>
  
  <p>but application crashes with <code>classCastException</code></p>
  
  <p>Technically this is possible, I think.</p>