Q:

finding the day based on date in java - gives incorrect answer

java.util.Date gives incorrect day as output.
    java.util.Date date = new Date(2014,03,01);
    System.out.println("day is" +date.getDay());

output : day is 3 
actually it should be 7 
Update : Thanks a lot I was able to get the output Here is my code 
    java.util.Calendar c = java.util.Calendar.getInstance();
    c.clear();
    c.set(year,month,dd);
    System.out.println("day of week "+c.get(java.util.Calendar.DAY_OF_WEEK));

A:

I guess you wanted to create the date March 1st 2014. But with your constructor call you create the date April 1st 3914!
The API tells you why:

A year y is represented by the integer y - 1900.
A month is represented by an integer from 0 to 11; 0 is January, 1 is February, and so forth; thus 11 is December.
A date (day of month) is represented by an integer from 1 to 31 in the usual manner.

EDIT: Also this constructor is deprecated. Use Calendar instead.

