i have experienced the same problem, the wrong u did was that the months in callender class starts from 0 to 11,
so 0=January,
1= February ,...
..
...
and so on...
the solution to that problem is ..
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int month = in.nextInt();
int day = in.nextInt();
int year = in.nextInt();
Calendar cal = Calendar.getInstance();
cal.set(cal.YEAR,year);
cal.set(cal.MONTH,month-1);
cal.set(cal.DATE,day);
switch(cal.get(Calendar.DAY_OF_WEEK))
{
case 1:System.out.println("SUNDAY");
break;
case 2:System.out.println("MONDAY");
break;
case 3:System.out.println("TUESDAY");
break;
case 4:System.out.println("WEDNESDAY");
break;
case 5:System.out.println("THURSDAY");
break;
case 6:System.out.println("FRIDAY");
break;
case 7:System.out.println("SATURDAY");
break;
}
}
}