{"id":18409,"date":"2022-09-09T12:50:33","date_gmt":"2022-09-09T07:20:33","guid":{"rendered":"https:\/\/copyassignment.com\/?p=18409"},"modified":"2022-12-03T18:17:20","modified_gmt":"2022-12-03T12:47:20","slug":"calendar-using-java-with-best-examples","status":"publish","type":"post","link":"https:\/\/copyassignment.com\/calendar-using-java-with-best-examples\/","title":{"rendered":"Calendar using Java with best examples"},"content":{"rendered":"\n<p>In this article, we are going to learn how to code Calendar using Java. The calendar application is occasionally asked in interviews to be built by the candidate. If you are intermediate in Java, it helps to improve your coding skills also, it is interesting to make this application. Let&#8217;s get started!<\/p>\n\n\n\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-9886351916045880\" data-ad-slot=\"2002566052\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Calendar class in Java<\/h2>\n\n\n\n<p><a href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/util\/Calendar.html\" data-type=\"URL\" data-id=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/util\/Calendar.html\" target=\"_blank\" rel=\"noreferrer noopener\">Calendar<\/a> class is an <strong><em>abstract class<\/em><\/strong> in Java that provides methods for multiple operations such as displaying the <strong><em>year<\/em><\/strong>, <strong><em>month<\/em><\/strong>, <strong><em>day<\/em><\/strong>, <strong><em>hour<\/em><\/strong>, etc. It inherits the Object class and implements the Comparable, Serializable, and Cloneable interfaces.<\/p>\n\n\n\n<p>Calendar&#8217;s&nbsp;getInstance method returns a&nbsp;Calendar object whose calendar fields have been initialized with the current date and time:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>     Calendar rightNow = Calendar.getInstance();<\/code><\/pre>\n\n\n\n<p>A&nbsp;Calendar&nbsp;object can produce all the calendar field values needed to implement the date and time formatting for a particular language and calendar style. The calendar field values can be set by calling the&nbsp;set&nbsp;methods. Any field values set in a&nbsp;Calendar&nbsp;will not be interpreted until it needs to calculate its time value or the values of the calendar fields. <\/p>\n\n\n\n<p>The calendar&nbsp;has two modes for interpreting the calendar fields,&nbsp;<strong><em>lenient<\/em><\/strong>&nbsp;and&nbsp;<em><strong>non-lenient<\/strong><\/em>. When a&nbsp;Calendar&nbsp;is in lenient mode, it accepts a broader range of calendar field values than it produces. When a&nbsp;Calendar&nbsp;is in non-lenient mode, it throws an exception if there is any inconsistency in its calendar fields. <\/p>\n\n\n\n<p>The date or time format strings are not part of the definition of a calendar, as those must be modifiable or overridable by the user at runtime.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Calendar methods in Java<\/h2>\n\n\n\n<p>There is a bundle of Calendar methods available in Java. These methods are used for a wide range of functions with Calendar using java. Let&#8217;s take a look at those methods in the following section.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">S.No<\/th><th class=\"has-text-align-left\" data-align=\"left\">Method Name<\/th><th class=\"has-text-align-left\" data-align=\"left\">Description<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">1<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>abstract void add(int field, int amount)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method adds or subtracts the specified amount of time to the given calendar field, based on the calendar&#8217;s rules<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">2<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>boolean after(Object when)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns whether the Calendar represents a time after the time represented by the specified Object<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">3<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>boolean before(Object when)<\/strong><br><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns whether the Calendar represents a time before the time represented by the specified Object.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">4<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void clear()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets all the calendar field values and the time value of the&nbsp;Calendar&nbsp;undefined<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">5<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void clear(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets the given calendar field value and the time value of the&nbsp;Calendar&nbsp;undefined<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">6<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>Object clone()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method creates and returns a copy of the object<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">7<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int compareTo(Calendar anotherCalendar)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method compares the time values represented by two&nbsp;Calendar&nbsp;objects<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">8<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>protected void complete()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method fills in any unset fields in the calendar fields.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">9<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>protected abstract void computeFields()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method converts the current millisecond time value&nbsp;time&nbsp;to calendar field values in&nbsp;fields[].<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">10<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>protected abstract void computeTime()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method converts the current calendar field values in&nbsp;fields[]&nbsp;to the millisecond time value&nbsp;time.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">11<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>boolean equals(Object obj)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method compares this&nbsp;Calendar&nbsp;to the specified&nbsp;Object.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">12<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int get(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the value of the given calendar field.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">13<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int getActualMaximum(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the maximum value that the specified calendar field could have, given the time value of the&nbsp;Calendar.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">14<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int getActualMinimum(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the minimum value that the specified calendar field could have, given the time value of this&nbsp;Calendar.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">15<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>static Locale[] getAvailableLocales()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns an array of all locales for which the&nbsp;getInstance&nbsp;methods of this class can return localized instances<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">16<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>String getDisplayName(int field, int style, Locale locale)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the string representation of the calendar&nbsp;field&nbsp;value in the given&nbsp;style&nbsp;and&nbsp;locale.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">17<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>Map&lt;String,Integer&gt; getDisplayNames(int field, int style, Locale locale)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns a&nbsp;Map&nbsp;containing all names of the calendar&nbsp;field&nbsp;in the given&nbsp;style&nbsp;and&nbsp;locale&nbsp;and their corresponding field values<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">18<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int getFirstDayOfWeek()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method gets what the first day of the week is; e.g.,&nbsp;SUNDAY&nbsp;in the U.S.,&nbsp;MONDAY&nbsp;in France.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">19<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>abstract int getGreatestMinimum(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the highest minimum value for the given calendar field of this&nbsp;Calendar&nbsp;instance.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">20<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>static Calendar getInstance()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method gets a calendar using the default time zone and locale.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">21<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>static Calendar getInstance(Locale aLocale)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method gets a calendar using the default time zone and specified locale.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">22<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>static Calendar getInstance(TimeZone zone)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method gets a calendar using the specified time zone and default locale.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">23<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>static Calendar getInstance(TimeZone zone, Locale aLocale)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method gets a calendar with the specified time zone and locale.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">24<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>abstract int getLeastMaximum(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the lowest maximum value for the given calendar field of this&nbsp;Calendar&nbsp;instance.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">25<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>abstract int getMaximum(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the maximum value for the given calendar field of this&nbsp;Calendar&nbsp;instance.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">26<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int getMinimalDaysInFirstWeek()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, this method returns 1.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">27<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>abstract int getMinimum(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the minimum value for the given calendar field of this&nbsp;Calendar&nbsp;instance.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">28<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>Date getTime()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns a&nbsp;Date&nbsp;as an object representing this&nbsp;Calendar&#8217;s time value<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">29<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>long getTimeInMillis()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns this Calendar&#8217;s time value in milliseconds.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">30<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>TimeZone getTimeZone()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method gets the time zone.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">31<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int getWeeksInWeekYear()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the number of weeks in the week year represented by this&nbsp;Calendar.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">32<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int getWeekYear()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the week year represented by this&nbsp;Calendar.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">33<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>int hashCode()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns a hash code for this calendar.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">34<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>protected int internalGet(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns the value of the given calendar field.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">35<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>boolean isLenient()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method tells whether date\/time interpretation is to be lenient.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">36<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong><br>boolean isSet(int field)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method determines if the given calendar field has a value set, including cases where the value has been set by internal fields calculations triggered by a&nbsp;<code>get<\/code>&nbsp;method call.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">37<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>abstract void roll(int field, boolean up)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method adds or subtracts a single unit of time on the given time field without changing larger fields.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">38<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void roll(int field, int amount)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method adds the specified amount to the specified calendar field without changing larger fields.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">39<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void set(int field, int value)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets the given calendar field to the given value.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">40<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void set(int year, int month, int date)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets the values for the calendar fields&nbsp;YEAR,&nbsp;MONTH, and&nbsp;DAY_OF_MONTH.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">41<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void set(int year, int month, int date, int hourOfDay, int minute)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets the values for the calendar fields&nbsp;YEAR,&nbsp;MONTH,&nbsp;DAY_OF_MONTH,&nbsp;HOUR_OF_DAY, and&nbsp;MINUTE.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">42<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void set(int year, int month, int date, int hourOfDay, int minute, int second)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets the values for the fields&nbsp;YEAR,&nbsp;MONTH,&nbsp;DAY_OF_MONTH,&nbsp;HOUR,&nbsp;MINUTE, and&nbsp;SECOND.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">43<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void setFirstDayOfWeek(int value)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets what the first day of the week is; e.g.,&nbsp;SUNDAY&nbsp;in the U.S.,&nbsp;MONDAY&nbsp;in France.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">44<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void setLenient(boolean lenient)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method specifies whether or not date\/time interpretation is to be lenient.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">45<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void setMinimalDaysInFirstWeek(int value)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets what the minimum days required in the first week of the year are; For example, if the first week is defined as one that contains the first day of the first month of a year, call this method with the value 1.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">46<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void setTime(Date date)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets this Calendar&#8217;s time with the given&nbsp;<code>Date<\/code>.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">47<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void setTimeInMillis(long millis)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets this Calendar&#8217;s current time from the given long value.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">48<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void setTimeZone(TimeZone value)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets the time zone with the given time zone value.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">49<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>void setWeekDate(int&nbsp;weekYear, int&nbsp;weekOfYear, int&nbsp;dayOfWeek)<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method sets the date of this&nbsp;Calendar&nbsp;with the given date specifiers &#8211; week year, week of the year, and day of the week.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">50<\/td><td class=\"has-text-align-left\" data-align=\"left\"><strong>String toString()<\/strong><\/td><td class=\"has-text-align-left\" data-align=\"left\">This method returns a string representation of this calendar.<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Calendar methods in Java<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Java Program to get date and time<\/h2>\n\n\n\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-9886351916045880\" data-ad-slot=\"2002566052\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>To get the current date and time we can use the getTime() method. Let&#8217;s see an example:<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><div style=\"position:absolute;top:-20px;right:0px;cursor:pointer\" class=\"copy-simple-code-block\"><span class=\"dashicon dashicons dashicons-admin-page\"><\/span><\/div><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"java\" data-theme=\"xcode\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"true\">import java.util.*;  \npublic class Main{  \n   public static void main(String[] args) \n   {  \n   \/\/ Creating Calendar object\n   Calendar calendar = Calendar.getInstance();  \n   \n   \/\/ To get the current date and time\n   System.out.print(\"Current Date and Time is - \" + calendar.getTime());  \n   }  \n}  <\/pre><\/div>\n\n\n\n<h3 class=\"has-medium-font-size wp-block-heading\">Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"473\" height=\"93\" data-src=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/4.png\" alt=\"Output of the Java Program to get the current date and time\" class=\"wp-image-18430 lazyload\" data-srcset=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/4.png 473w, https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/4-300x59.png 300w\" data-sizes=\"(max-width: 473px) 100vw, 473px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 473px; --smush-placeholder-aspect-ratio: 473\/93;\" \/><\/figure>\n\n\n\n<p>To get information about the current date, and time details separately we can use the following way.<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><div style=\"position:absolute;top:-20px;right:0px;cursor:pointer\" class=\"copy-simple-code-block\"><span class=\"dashicon dashicons dashicons-admin-page\"><\/span><\/div><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"java\" data-theme=\"xcode\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"true\">import java.util.*;\n\npublic class Main {\n   public static void main(String[] args) {\n   \n        \/\/ Creating Calendar object\n        Calendar calendar = Calendar.getInstance();\n        \n        \/\/ To get hour of the current day\n        int hours = calendar.get(Calendar.HOUR);\n        \n        \/\/ To get minute of the current day\n        int minutes = calendar.get(Calendar.MINUTE);\n        \n        \/\/ To get hour of the current day\n        int seconds = calendar.get(Calendar.SECOND);\n        \n        \/\/ To get hour of the current day\n        int milliseconds = calendar.get(Calendar.MILLISECOND);\n        \n        \/\/ To get hour of the current day\n        int day = calendar.get(Calendar.DATE);\n        \n        \/\/ To get hour of the current day\n        int month = calendar.get(Calendar.MONTH) + 1;\n        \n        \/\/ To get hour of the current day\n        int year = calendar.get(Calendar.YEAR);\n        \n        \/\/ To get hour of the current day\n        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);\n        \n        \/\/ To get hour of the current day\n        int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);\n        \n        \/\/ To get hour of the current day\n        int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);\n        \n        \/\/ To get hour of the current day\n        int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY);\n                \n        System.out.println(\"\\nCurrent Hour : \" + hours);\n        System.out.println(\"Current Minute : \" + minutes);\n        System.out.println(\"Current Second : \" + seconds);\n        System.out.println(\"Cuurent Millisecond : \" + milliseconds);\n        System.out.println(\"Current Date and Time : \" + calendar.getTime());\n        System.out.println(\"Current Date : \" + day);\n        System.out.println(\"Current Month : \" + month);\n        System.out.println(\"Current Year : \" + year);\n        System.out.println(\"Day of Week : \" + hourOfDay);\n        System.out.println(\"Day of Week : \" + dayOfWeek);\n        System.out.println(\"Day of Month : \" + dayOfMonth);\n        System.out.println(\"Day of Year : \" + dayOfYear);\n    }\n}<\/pre><\/div>\n\n\n\n<h3 class=\"has-medium-font-size wp-block-heading\">Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"450\" height=\"273\" data-src=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/6.png\" alt=\"Output for Calender using Java\" class=\"wp-image-18436 lazyload\" data-srcset=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/6.png 450w, https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/6-300x182.png 300w\" data-sizes=\"(max-width: 450px) 100vw, 450px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 450px; --smush-placeholder-aspect-ratio: 450\/273;\" \/><\/figure>\n\n\n\n<p>If we want to get the previous or following month, year or date we can use the following way.<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><div style=\"position:absolute;top:-20px;right:0px;cursor:pointer\" class=\"copy-simple-code-block\"><span class=\"dashicon dashicons dashicons-admin-page\"><\/span><\/div><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"java\" data-theme=\"xcode\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"true\">import java.util.*;  \npublic class Main{  \n   public static void main(String[] args) { \n   \n   Calendar calendar = Calendar.getInstance();  \n   \n   \/\/To get the date and time 25 days ago from the current date\n   calendar.add(Calendar.DATE, -25);  \n   System.out.println(\"25 days ago: \" + calendar.getTime());  \n   \n   \/\/To get the date and time 2 months later from the current date\n   calendar.add(Calendar.MONTH, 2);  \n   System.out.println(\"2 months later: \" + calendar.getTime());  \n   \n   \/\/To get the date and time 5 years later from the current date\n   calendar.add(Calendar.YEAR, 5);  \n   System.out.println(\"5 years later: \" + calendar.getTime());  \n   }  \n}  <\/pre><\/div>\n\n\n\n<h3 class=\"has-medium-font-size wp-block-heading\">Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"391\" height=\"123\" data-src=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/5.png\" alt=\"Output for Calender using Java\" class=\"wp-image-18434 lazyload\" data-srcset=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/5.png 391w, https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/5-300x94.png 300w\" data-sizes=\"(max-width: 391px) 100vw, 391px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 391px; --smush-placeholder-aspect-ratio: 391\/123;\" \/><\/figure>\n\n\n\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-9886351916045880\"\n     crossorigin=\"anonymous\"><\/script>\n<ins class=\"adsbygoogle\"\n     style=\"display:block\"\n     data-ad-format=\"autorelaxed\"\n     data-ad-client=\"ca-pub-9886351916045880\"\n     data-ad-slot=\"7933252109\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\">Java Program to print the Calendar of any month<\/h2>\n\n\n\n<p>We are going to write a Java program to print the Calendar for any month. The program prompts the user to enter the year and the month and then prints the calendar for the month of the year. We can solve the problem in many ways, as long as we get the same output. <\/p>\n\n\n\n<p>The program does validate user input. For instance, if the user enters either a month or not in the range between 1 and 12, the program would display an error. To avoid this error, add an if statement to check the input before printing the calendar.<\/p>\n\n\n\n<p>Some of the important points to be noted for writing the program are as follows.<br>1) January, March, May, July, August, October, and December have thirty-one days.<br>2) April, June, September, and November have thirty days.<br>3) February has twenty-eight days during a normal year and twenty-nine days during a leap year. A regular year, therefore, has 365 days, and a leap year has 366 days.<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><div style=\"position:absolute;top:-20px;right:0px;cursor:pointer\" class=\"copy-simple-code-block\"><span class=\"dashicon dashicons dashicons-admin-page\"><\/span><\/div><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"java\" data-theme=\"xcode\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"true\">#Importing the library\nimport java.util*;\n\npublic class MonthCalendar {\n\n     public static void main(String[] args) {\n     Scanner scan = new Scanner (System.in);\n     System.out.print(\"Enter year : \");\n     int year = scan.nextInt();\n     System.out.print(\"Enter month : \");\n     int month = scan.nextInt();\n\n      if (month &lt; 1 || month > 12)\n          System.out.println(\"Wrong input!\");\n      else\n          printMonth(year, month);\n   }\n     static void printMonth(int year, int month) {\n          printMonthTitle(year, month);\n          printMonthBody(year, month);\n    }\n      static void printMonthTitle(int year, int month) {\n          System.out.println(\"         \" + getMonthName(month) + \" \" + year);\n          System.out.println(\" Sun Mon Tue Wed Thu Fri Sat\");\n    }\n    static String getMonthName(int month) {\n      String monthName = null;\n      switch (month) {\n        case 1: monthName = \"January\"; break;\n        case 2: monthName = \"February\"; break;\n        case 3: monthName = \"March\"; break;\n        case 4: monthName = \"April\"; break;\n        case 5: monthName = \"May\"; break;\n        case 6: monthName = \"June\"; break;\n        case 7: monthName = \"July\"; break;\n        case 8: monthName = \"August\"; break;\n        case 9: monthName = \"September\"; break;\n        case 10: monthName = \"October\"; break;\n        case 11: monthName = \"November\"; break;\n        case 12: monthName = \"December\";\n      }\n      return monthName;\n    }\n    static void printMonthBody(int year, int month) {\n      int startDay = getStartDay(year, month);\n      int numberOfDaysInMonth = getNumberOfDaysInMonth(year, month);\n      int i = 0;\n      for (i = 0; i &lt; startDay; i++)\n        System.out.print(\"    \");\n      for (i = 1; i &lt;= numberOfDaysInMonth; i++) {\n        if (i &lt; 10)\n          System.out.print(\"   \" + i);\n        else\n          System.out.print(\"  \" + i);\n        if ((i + startDay) % 7 == 0)\n          System.out.println();\n      }\n      System.out.println();\n    }\n   static int getStartDay(int year, int month) {\n      int startDay1800 = 3;\n      int totalNumberOfDays = getTotalNumberOfDays(year, month);\n      return (totalNumberOfDays + startDay1800) % 7;\n    }\n    static int getTotalNumberOfDays(int year, int month) {\n     int total = 0;\n     for (int i = 1800; i &lt; year; i++)\n     if (isLeapYear(i))\n        total = total + 366;\n      else\n        total = total + 365;\n      for (int i = 1; i &lt; month; i++)\n        total = total + getNumberOfDaysInMonth(year, i);\n      return total;\n    }\n    static int getNumberOfDaysInMonth(int year, int month) {\n      if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)\n        return 31;\n      if (month == 4 || month == 6 || month == 9 || month == 11)\n        return 30;\n      if (month == 2) return isLeapYear(year) ? 29 : 28;\n      return 0; \n    }\n    static boolean isLeapYear(int year) {\n      return year % 400 == 0 || (year % 4 == 0 &amp;&amp; year % 100 != 0);\n    }\n}\n<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"319\" height=\"226\" data-src=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/2.png\" alt=\"Output for the Java program to print the Calendar of any month\" class=\"wp-image-18429 lazyload\" data-srcset=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/2.png 319w, https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/2-300x213.png 300w\" data-sizes=\"(max-width: 319px) 100vw, 319px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 319px; --smush-placeholder-aspect-ratio: 319\/226;\" \/><\/figure>\n\n\n\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-9886351916045880\" data-ad-slot=\"2002566052\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\">Java Program to print the Calendar of any month without using inbuilt Calendar methods<\/h2>\n\n\n\n<p>We are going to write a Java program to print the Calendar for any month. The program prompts the user to enter the year and the month and then prints the calendar for the month of the year. We can solve the problem in many ways, as long as we get the same output. <\/p>\n\n\n\n<p>First, let us take the year and the month as inputs from the user. Then, create two arrays for storing days and months, as per proper order. Initialize a counter variable and three variables, each for the day, month, and year as 1, and a separate array for storing the different combinations of days on which months can be found. <\/p>\n\n\n\n<p>Then, check the leap year condition for the input month and re-initialize values for the above array.  Increment year count as month count reaches 12 and increment month count as day count reaches a value greater than that present in the array for the respective index. Finally print the calendar.<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><div style=\"position:absolute;top:-20px;right:0px;cursor:pointer\" class=\"copy-simple-code-block\"><span class=\"dashicon dashicons dashicons-admin-page\"><\/span><\/div><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"java\" data-theme=\"xcode\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"true\">#Importing the libraries\nimport java.io.*;\nimport java.util.*;\n\npublic class MonthCalendar {\n  public static void main(String a[])\n  {\n    Scanner sc = new Scanner(System.in);\n    System.out.print(\"Enter the year : \");\n    int yy = sc.nextInt();\n    System.out.print(\"Enter month : \");\n    int mm = sc.nextInt();\n    int d = 1;\n    int month = 1;\n    int year = 1;\n    int day = 1;\n    \n    \/\/ Storing the name of days\n    String days[] = { \"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\" };\n    \n    \/\/ Storing the name of months\n    String months[]\n      = { \"JANUARY\", \"FEBRUARY\", \"MARCH\",\"APRIL\", \"MAY\",  \"JUNE\",\n        \"JULY\", \"AUGUST\", \"SEPTEMBER\",\"OCTOBER\", \"NOVEMBER\", \"DECEMBER\" };\n        \n    \/\/ Storing the number of days in each month\n    int ar[] = { 31, 29, 31, 30, 31, 30,31, 31, 30, 31, 30, 31 };\n    \n    while (true) {\n      if (d == 1 &amp;&amp; month == mm &amp;&amp; year == yy) {\n        break;\n      }\n      if (year % 4 == 0 &amp;&amp; year % 100 != 0 || year % 100 == 0) {\n        ar[1] = 29;\n      }\n      else {\n        ar[1] = 28;\n      }\n      day++;d++;\n      \n      if (d > ar[month - 1]) {\n        month++;\n        d = 1;\n      }\n      if (month > 12) {\n        month = 1;year++;\n      }\n      if (day == 7) {\n        day = 0;\n      }\n    }\n    int c = day;\n    if (year % 4 == 0 &amp;&amp; year % 100 != 0 || year % 400 == 0) {\n      ar[1] = 29;\n    }\n    else {\n      ar[1] = 28;\n    }\n    System.out.println(\"MONTH:\" + months[mm - 1]);\n    for (int k = 0; k &lt; 7; k++) {\n      System.out.print(\" \" + days[k]);\n    }\n    System.out.println();\n    for (int j = 1; j &lt;= (ar[mm - 1] + day); j++) {\n      if (j > 6) {\n        day = day % 6;\n      }\n    }\n    int spaces = day;\n    if (spaces &lt; 0)\n      spaces = 6;\n      \n    # Printing the Calendar\n    for (int i = 0; i &lt; spaces; i++)\n      System.out.print(\"   \");\n    for (int i = 1; i &lt;= ar[mm - 1]; i++) {\n      System.out.printf(\" %2d \", i);\n      \n      if (((i + spaces) % 7 == 0)\n        || (i == ar[mm - 1]))\n        System.out.println();\n    }\n  }\n}\n<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"314\" height=\"215\" data-src=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/1.png\" alt=\"Output for Java program to print the calendar of any month without using inbuilt Calendar methods\" class=\"wp-image-18427 lazyload\" data-srcset=\"https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/1.png 314w, https:\/\/copyassignment.com\/wp-content\/uploads\/2022\/09\/1-300x205.png 300w\" data-sizes=\"(max-width: 314px) 100vw, 314px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 314px; --smush-placeholder-aspect-ratio: 314\/215;\" \/><\/figure>\n\n\n\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-9886351916045880\"\n     crossorigin=\"anonymous\"><\/script>\n<ins class=\"adsbygoogle\"\n     style=\"display:block\"\n     data-ad-format=\"autorelaxed\"\n     data-ad-client=\"ca-pub-9886351916045880\"\n     data-ad-slot=\"7933252109\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>In this article, we have learned to code Calender using Java. We have also discussed the Calender class and methods in Java. We also discussed how to print calendar of any Month without the use of the Calendar class. Hope you enjoyed learning and coding with us!<\/p>\n\n\n\n<div style=\"text-align:center\" class=\"wp-block-atomic-blocks-ab-button ab-block-button\"><a href=\"https:\/\/copyassignment.com\/?s=java\" class=\"ab-button ab-button-shape-rounded ab-button-size-medium\" style=\"color:#ffffff;background-color:#3373dc\">Learn Java for Free with projects<\/a><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Also Read:<\/strong><\/p>\n\n\n<ul class=\"wp-block-latest-posts__list is-grid columns-3 wp-block-latest-posts\"><li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/download-1000-projects-all-b-tech-programming-notes-job-resume-interview-guide-and-more-get-your-ultimate-programming-bundle\/\">Download 1000+ Projects, All B.Tech &#038; Programming Notes, Job, Resume &#038; Interview Guide, and More &#8211; Get Your Ultimate Programming Bundle!<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/music-recommendation-system-in-machine-learning\/\">Music Recommendation System in Machine Learning<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/dino-game-in-java\/\">Dino Game in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/java-games-code-copy-and-paste\/\">Java Games Code | Copy And Paste<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/supply-chain-management-system-in-java\/\">Supply Chain Management System in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/survey-management-system-in-java\/\">Survey Management System In Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/phone-book-in-java\/\">Phone Book in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/email-application-in-java\/\">Email Application in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/inventory-management-system-project-in-java\/\">Inventory Management System Project in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/blood-bank-management-system-project-in-java\/\">Blood Bank Management System Project in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/electricity-bill-management-system-project-in-java\/\">Electricity Bill Management System Project in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/cgpa-calculator-app-in-java\/\">CGPA Calculator App In Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/chat-application-in-java\/\">Chat Application in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/crud-operations-in-servlet-jsp\/\">CRUD Operations in Servlet &amp; JSP<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/100-java-projects-for-beginners-2023\/\">100+ Java Projects for Beginners 2023<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/airline-reservation-system-project-in-java\/\">Airline Reservation System Project in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/password-and-notes-manager-in-java\/\">Password and Notes Manager in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/gui-number-guessing-game-in-java\/\">GUI Number Guessing Game in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/how-to-create-notepad-in-java\/\">How to create Notepad in Java?<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/memory-game-in-java\/\">Memory Game in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/simple-car-race-game-in-java\/\">Simple Car Race Game in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/atm-program-in-java\/\">ATM program in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/drawing-application-in-java\/\">Drawing Application In Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/tetris-game-in-java\/\">Tetris Game in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/pong-game-in-java\/\">Pong Game in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/hospital-management-system-project-in-java\/\">Hospital Management System Project in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/ludo-game-in-java\/\">Ludo Game in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/restaurant-management-system-project-in-java\/\">Restaurant Management System Project in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/flappy-bird-game-in-java\/\">Flappy Bird Game in Java<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/copyassignment.com\/hackerrank-day-8-solution-in-python-dictionaries-and-maps\/\">HackerRank Day 8 Solution in Python: Dictionaries and Maps<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>In this article, we are going to learn how to code Calendar using Java. The calendar application is occasionally asked in interviews to be built&#8230;<\/p>\n","protected":false},"author":62,"featured_media":18447,"comment_status":"closed","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,1895,1918,1894],"tags":[],"class_list":["post-18409","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-allcategorites","category-java","category-java-projects","category-tutorial","wpcat-22-id","wpcat-1895-id","wpcat-1918-id","wpcat-1894-id"],"_links":{"self":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/posts\/18409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/comments?post=18409"}],"version-history":[{"count":0,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/posts\/18409\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/media\/18447"}],"wp:attachment":[{"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/media?parent=18409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/categories?post=18409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/copyassignment.com\/wp-json\/wp\/v2\/tags?post=18409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}