Java leap year date example

Java leap year date example

  1. Write a Java Program with file name SectionB.java using Switch control Statement

The program will use the JOptionPane and ask the user to enter any number between 1 to 12.

Based on the input, then the program will show how many days in that month. For example if the user enters 1, the program will show â??The Month you entered is January and it has 31 daysâ??. The output will be shown in the JOptionpane.

  1. Now modify the program; if the user enters â??2â?? the program will ask the user if it is a leap year. If the answer from the user is â??Yesâ?? it will show the message â??February has 29 daysâ??, if the response from the user is â??Noâ?? it will show â??February has 28 daysâ??. Again, the output should be shown in JOptionPane.

NOTE:

[In this program use try and catch block to handle any unacceptable and invalid input from the user]

View Answers









Related Tutorials/Questions & Answers:
java leap year
java leap year  write a java program that takes an input... whether itis a leap year. Aleap year is an integer greater than 1584...("It is a leap year."); } else{ System.out.println("It is not a leap
Java Leap Year Problem
Java Leap Year Problem  I need help with a writing a program in Java that creates a class Year that contains a data field that holds the number of months in a year and the number of days in a year. It should include a get method
Advertisements
leap year logic - Java Beginners
leap year logic  hi frds.. can u give me logic for leap year..  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/Leapyear.shtml Thanks
leap year
leap year  how to create class for leap year. It is leap year...(); if (year.isLeapYear(y)){ System.out.println("It is a leap year."); } else{ System.out.println("It is not a leap year
Determining If a Year is a Leap Year in Java
Determining If a Year is a Leap Year in Java       Leap Year: Leap Year is the year contains an extra day. In the leap year, February month contains 29 days since normally
Checking whether a year is leap or not
Checking whether a year is leap or not   ... for checking whether a year is a leap year or not. Here, we have taken the year 2000. So...;if else" condition. As we know leap year is divided by the integer 4 and so
Java get year from date
Java get year from date     ... the date. You can see in the given example that we have called SimpleDateFormat class showing the format of year. The method simpleDateformat.format(date) formats
convert date month and year into word using java
convert date month and year Java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
Addintion in year fields of sql date in a java page
Addintion in year fields of sql date in a java page  In my database...("Year: " + simpleDateformat.format(date)); String k= simpleDateformat.format(date); } But I have to add 4 with the year value
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Java Date Month Format  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Date Format in Jave  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Convert Date Month format  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
convert date month and year  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Match Date format  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Basic format for Date and Month  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Convert Date Format  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
Add year to Date without using Calendar in java
Add year to Date without using Calendar in java  how could i add a year to a date function without using calendar functions
PHP Date add 1 year
program. <?php //Example to add 1 year to a date objectADS... Adding 1 year to a php date object is sometimes useful to solve some...;"; //Add one year to current date $dateOneYearAdded = strtotime(date("
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   import java.util.*; import java.text.
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   import java.util.*; import java.text.
Mysql Year of Date
from 'Mysql Year of Date'. To understand and grasp the example we use...; table as fieldname YEAR(CURRENT_DATE). In this example to show the year... Mysql Year of Date      
Mysql Date Add Year
an example from 'Mysql Date Add Year'. To graspe this example, we use Add... Mysql Date Add Year       Mysql Date Add Year explains to add the year to the particular
leap
leap   Check the given year for leap year (Test Case: 2010, 2012 , 1900
Mysql Date Get Year
'Mysql Date Get Year'. To understand and grasp this example, we use... Mysql Date Get Year       Mysql Date Get Year is the way of retrieving the current year
JDBC : Get year from Date
) { System.out.println("Get year from date Example..."); Connection conn = null; String...) { e.printStackTrace(); } } } Output : Get year from date Example...JDBC : Get year from Date In this section, you will learn how to get year
Java date add year
Java date add year In this tutorial, you will learn how to add years to date. Here, we are going to add few years to current date and return the date of that day. For this, we have created a calendar instance and get a date
JSP:How to get year of system date - Date Calendar
Year: "+year ); } } For more Examples on Java visit to : http://www.roseindia.net/java/java-get-example/ Thanks...JSP:How to get year of system date  Please tell me how to get year
Java Find Next Date Example
of the input date. In this example we will handle the leap year also. To create...Java Find Next Date Example In this example we will discuss about how to find the next date of the input date. This example explains you about how
Year Format Example
Year Format Example       This example shows how to format Year using Format class... and parsing dates. It allows for formatting date into text , parsing text into date
how to display(update) current date and month in select box on selecting the year.
how to display(update) current date and month in select box on selecting the year.  how to display(update) current date and month in select box on selecting the year
date example with database
date example with database  i want to insert date in database(oracle) through jsp. thanx in advance
Hibernate criteria date Example
Hibernate criteria date Example  Example of Hibernate criteria date. Check the tutorial hibernate criteria date. Check the Latest tutorials, articles and examples of Hibernate Framework. Thanks
Simple Date example
Simple Date example       In this section we have presented a simple Date example.... Parameterized constructor :- Date(int year,int month,int day) creates
Java Get Method
and year from date in Java?": ADS_TO_REPLACE_2 Code for Java Get... when and how to use get method in Java. ADS_TO_REPLACE_1 The example is going to show the date details.. including year, date and month etc
Hibernate criteria for date. Example
Hibernate criteria for date. Example  What to use the Hibernate criteria for date in Hibernate based application? I want example of Hibernate criteria for date in Hibernate orm. Thanks   Example of Hibernate criteria
Hibernate Criteria Max Date Example
for finding max Date in Java program then check the following links: Example...Hibernate Criteria Max Date Example   How to write example program... want to use Hibernate Criteria for finding max Date in Java program then check
Date Java - Java Beginners
] ) return testDay; // check for leap year if ( month == 2 && testDay == 29... testDate = new Date( 11, 27, 1988 ); // test incrementing of day, month and year...Date Java  I'm using the eclipse software and I get an error for my
Java String To Date
string will be convert into Java date object. In this example we will first...Java String To Date In this section you will read about how to convert... be convert into java.util.Date. Java string to date convert explains
Java Date Format Example
Java Date Format Example You can format date in many ways. In this tutorial Format class is used to format the java date in to the different formats... = dateFormat.format(date); You can format the date into specific locale. For example
Java Date Example
Java Date Examples       Getting astrological sign according to birth date..._TO_REPLACE_1 Suppose in our example we have initialized the date, which is to be checked
Hibernate criteria date between Example
Hibernate criteria date between Example  Hibernate criteria date between Example I want example of hibernate criteria date between with source code. Share me the url. Thanks   Example of Hibernate criteria date
Date Tool Example
Date Tool Example       This Example shows you how to display date and time velocity. ... created Date class object by using Calender class object. $date.getHours
Java Date
different format of date in Java. Following example creates date object...Java Date  Hi, What is the API for Date management in Java? How use the Java Date API for manipulating date object in Java? Provide some
Date Field Midlet Example
Date Field MIDlet Example       This example illustrates how to insert date field in your form. We... below. ADS_TO_REPLACE_2 and you can select your choice of date, month and year
Java Coding - Date Calendar
Java Coding  Write a program that prompts the user to enter the year and first day of the year and displays the calendar for the year on the console. For example,if the user entered the year 2005, and 6 for Saturday, January
Mysql Date Query
; Mysql Date Query Date Query is used to return the current date, month and year... an example from 'Mysql Date Query'. To understand this example we use current... is used to return you the current date, month and year as fieldname current
Java converts any given year to Roman Numeral
Java converts any given year to Roman Numeral  Write a program that converts any given year to Roman Numeral

Ads