title: How to get the weekday of a Date?
body: <p>I want to get the day of week from the Java <code>Date</code> object when I have an array of <code>Date</code> in String with me.</p>
  
  <pre><code>SimpleDateFormat  sourceDateformat = new SimpleDateFormat("yyyy-MM-dd");
  public String[] temp_date;
  public Int[] day = new Int[5];
  Date[] d1= new Date[5];
  Calendar[] cal= new Calendar[5]
  
    try {
       d1[i]= sourceDateformat.parse(temp_date[i].toString());
       cal[i].setTime(d1[i]);   // its not compiling this line..showing error on this line
       day[i]= cal[i].get(Calendar.DAY_OF_WEEK);      
      } 
   catch (ParseException e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>Does anyone know the answer to this?</p>