Comment

Lukmanul Hakeem
Checking whether a year is leap or not-Correction,
October 7, 2010 at 11:20 AM

public class Example {
public void find(int n)
{
if((n%4==0&&n%100!=0)||(n%400==0))
{
System.out.println("Leap Year") ;
}
else
{
System.out.println("Not Leap Year") ;
}
}
View All Comments | View Tutorial
Related Tutorial and Articles
Java Tips and Examples

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 Beginners

java leap year
whether itis a leap year. Aleap year is an integer greater than 1584...java leap year  write a java program that takes an input... any year:" ); int y = in.nextInt(); LeapYear year = new LeapYear

Java-Tutorials

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... that is the leap year. This section determines whether the given year is leap year

Java Beginners

Java Leap Year Problem
Java Leap Year Problem  I need help with a writing a program in Java...() { System.out.println("The year has " + days + " days."); } } { LeapYear() { super(366...[]) { Year year2001 = new Year(); LeapYear year2000 = new LeapYear(); year2001.getDays

Java Beginners

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

Java Beginners

leap year
leap year  how to create class for leap year. It is leap year...:" ); int y = in.nextInt(); LeapYear year = new LeapYear(); if (year.isLeapYear(y)){ System.out.println("It is a leap year

Java Beginners

leap
leap   Check the given year for leap year (Test Case: 2010, 2012 , 1900

Java Beginners

MISTAKES CORRECTION - Java Beginners
MISTAKES CORRECTION   Dear Sir, The under mentioned Java Sleep programe was received through your favor. But when I compiled, the following notes displayed in the command prompt. Note: AppletSleep.java

Java Beginners
General

Calendar
of the Gregoriancalendar class and also checking whether the year is leap or not and printing... format of the days for this month. We are also checking whether the year is leap or not. Description of program:  In the given example first we

Java Beginners

pava program - Java Beginners
pava program  program to display whether the given year is LEAP YEAR... % 100 != 0) { System.out.println(year + " is a Leap year...) { System.out.println(year + " is a Leap year."); } // It is Divisible

Java Beginners

Checking the decimal whether comma used or not
Checking the decimal whether comma used or not  I need to check the given integer whther comma used or not. For example. If the user given 123456 The output should be like 123,456 If the user given 123,456 The output should

Java Tips and Examples

Listing out leap years between certain period
.  As we know a leap year is divisible by 4, define an integer l=n%4. So if 'n' is divisible by 4 or l=0, then the particular year can be a leap year. For checking this, apply the if statement and if this satisfies then, the year

Java Beginners

stock checking in java with backend as access
stock checking in java with backend as access  Hi, I am doing a project in java,Can i able to know how to check the stock availability of a product in java...my back end connectivity is ms-access from the database ,i hv

Java Beginners

java program - Java Beginners
java program  program to find whether the given year is a LEAP YEAR or not?  Hello, Try the following code to check whether the year is leap year or not. public class CheckLeapYear { public static void

Ajax Questions

checking the data
checking the data  Sir, I have built an application where a user types a long string as input. Then after he/she types a single word of that string... typed in is "With regards to the correction in pay" later on in the search module

Java Beginners

Check Whether Record is already Exists or Not with Database Connectivity - Java Beginners
Check Whether Record is already Exists or Not with Database Connectivity  Hello Sir I want Program to Check Whether ID is Already exists in the database with Swing Application ,if It is Already Exists then I want To Show MsgBox

Java Beginners

Date Java - Java Beginners
] ) return testDay; // check for leap year if ( month == 2 && testDay == 29... based on month private int year; // any year // constructor: confirm.... Set to month 1." ); } year = theYear; day = checkDay ( theDay

Java Beginners

name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each... out put . Enter day of birth: 02 Enter month of birth: 10 Enter year of birth

Java Beginners

name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each birthday in Chinese but i dont know how to do.   import java.util.

Spring Framework Questions

Validaton(Checking Blank space) - Spring
Validaton(Checking Blank space)  Hi i am using java springs .I am having problem in doing validation. I am just checking blank space. This is my controller. I named it salescontroller. package controller; import

Hibernate-Tutorials

Dirty Checking In Hibernate
Dirty Checking In Hibernate In this section we will read about the dirty checking in hibernate. Dirty Checking is the feature of hibernate that helps... for dirty checking. In an inspection strategy, a snapshot of the object

Java Beginners

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

Java Tips and Examples

Beginners Java Tutorial
'*'.   Checking whether a year is leap or not This tutorial is going to teach you the coding for checking whether a year is a leap year or not. Here... and the calendar format of the days for this month. We are also checking whether the year

General

End of Year Puzzle
Puzzle in Java Here am going to write a question as a puzzle, it is also very similar to the those questions you find in the SCJP (Sun Certified Java Programmer)  examination public class LittleFuzzy { public int method(int

Java Beginners

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

Java Beginners

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

Java Beginners

Retrieve all the students in the same year(Java ArrayList)?
Retrieve all the students in the same year(Java ArrayList)?  FoundStudents.jsp year- parameter I receive from a form search- is an object of type Student, with ID, name, year <% Student search = null; ArrayList<Student>

General

Java get Year
Java get Year       In this section, you will learn how to obtain the current year. The Calendar.... The method cal.get(Calendar.YEAR) will return the current year. Here

Java Beginners

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

Java Beginners

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

Java Beginners

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

Java Beginners

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

Java-Tutorials

Exceptions Rethrowing with Improved Type Checking
Exceptions Rethrowing  with Improved Type Checking In this section, you will learn about the Java SE 7 exception rethrowing with improved type checking. Take a a look at the following code having improved type checking of Java

Java Beginners

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

Java Beginners

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

Java Beginners

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

Java Beginners

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

Java Beginners

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

Java Beginners

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

Date Calendar

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

Java Interview Questions

java program to compare two hashmaps and check whether they are equal or not
java program to compare two hashmaps and check whether they are equal or not  java program to compare two hashmaps and check whether they are equal

Java Interview Questions

java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion

Java Interview Questions

java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion

Java Interview Questions

java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion

Java Interview Questions

java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion

Java Interview Questions

java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion

Java Interview Questions

java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion

Java Interview Questions

java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion

WebSevices Questions

help regarding creation of last year project
help regarding creation of last year project  i dont know whether i picked up the right category or not. actually m a last year bsc it student. i want to develop a website I-NAVIGATOR like the m-indicator mobile app. i want

Java Beginners

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.

Java Beginners

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.

General

Java get year from date
Java get year from date       In this section you will study how to retrieve the year from... showing the format of year. The method simpleDateformat.format(date) formats

Java Beginners

Two compilation errors.Can anyone help soon. - Java Beginners
;= daysPerMonth[ month ] ) return testDay; // check for leap year... Date.java to perform error-checking on the initial values for instance fields month, day and year. Also, provide a method nextDay() to increment the day by one

Java Beginners

Write a program that converts any given year to Roman Numeral in Java
Write a program that converts any given year to Roman Numeral in Java  Write a program that converts any given year to Roman Numeral

Mobile Applications Questions

UITextfield checking
UITextfield checking  hello,, how can i check UITextfield length or any specific value..   hii, here is some code for textfield checking if ([name.text isEqualToString:@"hello"]) or if (name.text.length<1

Java Beginners

Java Increment Date. - Java Beginners
Java Increment Date.  Create a program called Date.java to perform error-checking on the initial values for instance: fields month, day and year...: a) incrementing into the next month. b) incrementing into the next year What I

Java Beginners

program - Java Beginners
not know what to do,,,,,, write a program to enter date ( date,month, and year) and check the validity for date , month, and leap year......  Hi...; } return returnString; } function daysInFebruary(year

Date Calendar

JSP:How to get year of system date - Date Calendar
=Calendar.getInstance(); int year=cal.get(Calendar.YEAR); System.out.println("Current Year: "+year ); } } For more Examples on Java visit to : http...JSP:How to get year of system date  Please tell me how to get year

Java Beginners

date.java - Java Beginners
-checking on the initial values for instance: fields month, day and year. Also...date.java  Hi, this my first time taking java so could you help me...: a) incrementing into the next month. b) incrementing into the next year.   Hi

Java Beginners

java - Java Beginners
try to join the club, and queries can be accepted as to whether someone... an ACCEPT Set up a temporary stack. Copy the stack over, checking for the surname... the list. Technicalities 1. Use Java 1.4

Java Tips and Examples

Checking if a file or directory exist
Checking if a file or directory exist In this section you will learn how to check whether a file or a directory exist or not. The " java.io "... and check whether file or directory exist or not. import java.io.File; public

Hibernate Questions

Dirty Checking In Hibernate Example
Dirty Checking In Hibernate Example  What is the example of Dirty Checking in Hibernate? Give me some of the example code? Thanks

PHP Questions

php dynamic array checking
php dynamic array checking  php dynamic array checking

PHP Questions

php dynamic array checking
php dynamic array checking  php dynamic array checking

Hibernate Questions

Dirty Checking In Hibernate Example
Dirty Checking In Hibernate Example  Hi, What is Dirty Checking... Checking In Hibernate is an mechanism for automatically detects the changes in the state of an Entity. Check tutorial at Dirty Checking In Hibernate section

Mobile Applications Questions

wrong year
wrong year..   I think u are using other calendar Check Settings

Java Beginners

rEPLY  hi, This is session code i am calling admin_home1.jsp then data will be not displaying its urgent requirement please send me correction Thanks   Hi friend, To display the session

XML Tutorials

XML Error Checking and Locating
XML Error Checking and Locating     ... program helps you in checking and locating an error in XML document...; </Employee> </Employee-Detail> Here is the Java File

Hibernate Questions

Dirty Checking In Hibernate Example
Dirty Checking In Hibernate Example  What is the example of Dirty Checking in Hibernate? Give me some of the example code? Thanks   The Dirty Checking In Hibernate is used to track the status of the entity and detect

Hibernate Interview Questions

Dirty checking feature of hibernate.
Dirty checking feature of hibernate.  What is the dirty checking feature of Hibernate?   Hi friends, Dirty checking is a feature of hibernate. It allows the user or developer to avoid the time consuming databases

Java Beginners

tinny ennis - Java Beginners
try to join the club, and queries can be accepted as to whether someone... an ACCEPT Set up a temporary stack. Copy the stack over, checking for the surname... the list. Technicalities 1. Use Java 1.4

Java Tips and Examples

Check Empty String
str):  Use this method for checking a string whether it is not empty("...; In this example we are checking a sting object containing empty or null value. Apache has provided two methods isBlank() and isNotBlank() for checking

Java Beginners

I need help in doing this. - Java Beginners
)) { System.out.print(year + " is a leap year"); isLeap = true; } else System.out.println(year + " is not a leap year"); System.out.flush(); return isLeap... { private int month; private int day; private int year

Java Code Examples

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

Java Beginners

Avanced objects - Java Beginners
through the collection of limbs and checking what type of limb they are. Note that you... to indicate whether or not a human with the specified age is allowed to watch... the MovieRating class to determine whether the child can watch the movie. 14. Add

Java Beginners

JAVA program - Java Beginners
JAVA program  Write a JAVA program to accept a number and find whether it is a magic number

Java Beginners

JAVA program - Java Beginners
JAVA program  Write a JAVA program to accept a number and find whether it is a magic number

JDBC Questions

checking index in prepared statement
checking index in prepared statement  If we write as follows: String query = "insert into st_details values(?,?,?)"; PreparedStatement ps = con.prepareStatement(query); then after query has been prepared, can we check the index

Hibernate-Tutorials

Hibernate Dirty Checking
This section contains the concept of Hibernate dirty checking

JavaScript Questions

Just checking elswhere
Just checking elswhere  I have been posting some questions within the HTML group but getting no joy. I thought I would try another area. The main question I was looking for is: I have a textarea box which post a single users

Java Beginners

java programs - Java Beginners
java programs   I am trying to write a program that prompts the user to enter the month and year and displays the number of days in the month. Need...); System.out.print("Enter year: "); int year=input.nextInt(); System.out.print("Enter

General

Car Rental Application in Java
Car Rental Application in Java In this section, we are going to create a Java application regarding car renting, booking and checking the availability... whether he/she want to proceed or not. If user wants to proceeds, user is allowed

Programming Tutorials

Given a code listing, determine whether it is a legal and appropriate way to programmatically access a caller's security context.
whether it is a legal and appropriate way to programmatically access a caller's...;Next    Given a code listing, determine whether... in the environment. Object result = initCtx.lookup("java:comp/env/ejb

Java Beginners

Java code - Java Beginners
Java code  Develop date class in Java similar to the one available... day; private final int year; public Date(int m, int d, int y) { if (!isValid(m, d, y)) throw new RuntimeException("Invalid"); month = m; day = d; year

Java Beginners

java Date - Java Beginners
java Date  Dear sir I have an assignment, It is .. "Develop Date class in java similar to the one available in java.util package.Use JavaDoc...; private final int day; private final int year; public Date(int m, int d

Java Beginners

java - Java Beginners
for scanning a file for virus checking

JavaScript Questions
Java Beginners

Java Project - Java Beginners
Java Project  Hey, thanks for everything your doing to make us better. Am trying to work on a project in java am in my first year doing software Engineering and the project is m end of year project. Am really believing

Java Tools

Checking Directory existence on Ftp Server
In this section, you will learn how to check existence of a directory on the server by using java

Java Tools

Checking File existence on Ftp Server
In this section, you will learn how to check existence of a file on the server by using java

Hibernate Interview Questions

What is the dirty checking feature of Hibernate?
What is the dirty checking feature of Hibernate?  What is the dirty checking feature of Hibernate?   Hibernate allows dirty checking... process of updating the changed object is called automatic dirty checking. Dirty

Java Beginners

Java code - Java Beginners
Java code  I need help in writing code for converting julian date...); public static double convertToJulian(int[] ymd) { int year=ymd[0]; int month=ymd[1]; int day=ymd[2]; int jyear = year; int jmonth

Java Beginners

a java program - Java Beginners
for more information. http://www.roseindia.net/java/beginners/PrimeNumber.shtml... a java program  well sir, i just wanna ask you something regarding that if the question say .....write a program to check whether a number is even

Mobile Applications Questions

Checking the CustomItem in j2me support traversal or not?
Checking the CustomItem in j2me support traversal or not?  Hi, How should i check the CustomItem in j2me support traversal or not. Thanks & Regards, Sivakumar.J

Java Beginners

How to calculate days in a year
How to calculate days in a year  Hi, How to calculate no of days in a year? I want a program that calculates no of days in a year by specifying year... of calculating days in a year? Thanks

Java Beginners

java servlets - Java Beginners
java servlets  hai my question is on xml documentation in creation of a java servlets. whether we have to create for each and every servelet we have to create each xml documentation?   Hi friends Exactly what you

Java Beginners

Error in checking null value in string
Error in checking null value in string  Error in checking null value in string Hi am getting Exception : java.lang.NullPointerException in the following code: String registerno=null; registerno=request.getParameter("registerno

Java Beginners

Collection Framework - Java Beginners
Collection Framework  Pls explain the disadvantages of using collection framework as it was written in this forum ? It must cast to correct type. ? Cannot do compile time checking. I couldnot get in detail as to what

Java Beginners

java programming - Java Beginners
java programming  hi sir, i hav send u a code jus now regarding that program but it tends to be having error. Can u help me check? And still not sure whether some place got error