title: java util date value of string
body: <p>This is a method in an EJB for adding booking, I'm trying to set a to value of String Arr because Arr is a string which gets the form value in the Servlet and I want to do the same for d to value of String Dept. I'm using <code>java.util.Date</code>, it works for <code>java.sql.Date</code> but not for <code>java.util.Date</code>.</p>
  
  <pre><code>public void addBooking(String Arr,  String Dept, String username, String roomnum){
      BookingTableClass booking = new BookingTableClass();
  
      Date a= Date.valueOf(Arr);//the problem is in these four lines
      booking.setarrivalDate(a);
      Date d= Date.valueOf(Dept);
      booking.setdeptDate(d);
  
              booking.setCustomerUsername(username);  
      Long rmnum = Long.valueOf(roomnum);
      booking.setRoomNumber(rmnum);}
  </code></pre>