title: How to print day of the given date month year?
body: <p>In this I get leap &amp; ordinary year and month, but I don't know how to get day of the given date month year.  And also having one question: 1800 and 1900 are ordinary year but I get these years are leap year. Can you solve this?</p>
  
  <pre><code>import java.util.Scanner;
  
  class day {
  
      public static void main(String arg[]) {
          int tm, sm, w;
          int y;
          int[] m = new int[12];
          m[0] = 31;
          m[1] = 28;
          m[2] = 31;
          m[3] = 30;
          m[4] = 31;
          m[5] = 30;
          m[6] = 31;
          m[7] = 31;
          m[8] = 30;
          m[9] = 31;
          m[10] = 30;
          m[11] = 31;
          //{31,28,31,30,31,30,31,31,30,31,30,31};
          String[] mo = new String[12];
          mo[0] = "January";
          mo[1] = "February";
          mo[2] = "March";
          mo[3] = "April";
          mo[4] = "May";
          mo[5] = "June";
          mo[6] = "July";
          mo[7] = "August";
          mo[8] = "September";
          mo[9] = "October";
          mo[10] = "November";
          mo[11] = "December";
          String[] we = new String[w];
          we[0] = "Sunday";
          we[1] = "Monday";
          we[2] = "Tuesday";
          we[3] = "Wednesday";
          we[4] = "Thursday";
          we[5] = "Friday";
          we[6] = "Saturday";
          Scanner ip = new Scanner(System.in);
          System.out.print("\nEnter year ");
          y = ip.nextInt();
          System.out.print("\nEnter month ");
          sm = ip.nextInt();
          if (y % 4 == 0) {
              m[1] = m[1] + 1;
              for (tm = 1; tm &lt;= m.length; tm++) {
                  if (tm == sm) {
                      System.out.print("\n" + y + " is a Leap Year\n"
                              + mo[sm - 1] + " month " + "has " + m[sm - 1] + " days\n");
                  }
              }
          } else {
              for (tm = 1; tm &lt;= 12; tm++) {
                  if (tm == sm) {
                      System.out.print("\n" + y + " is an Ordinary year\n"
                              + mo[sm - 1] + " month " + "has " + m[sm - 1] + " days\n");
                  }
              }
          }
      }
  }
  </code></pre>