Comment

mingjian zheng
wrong,
February 4, 2009 at 11:29 PM

The leap year is the year that is divided by the integer 4 and isn't divided by 100 or is divided by 400.
So:
if ((n%4==0 && n%100 != 0) || n%400 == 0){
System.out.println("The given year is a leap year");
}
else{
System.out.println("This is not a leap year");
}


View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Java Beginners

What's wrong with my form? - Java Beginners
What's wrong with my form?  Dear expert, I'm having trouble with my enquiry form. Hope you can tell me where my mistake lies. Thanks. Here's my jsp code: Enquiries var objForm = new Object 

Java Beginners

What's wrong with my pagination code in JSP?
What's wrong with my pagination code in JSP?  Dear experts, I've tried the following codes which I have copied from Java Ranch forum and deleted...;%@ page language="java" contentType="text/html; charset=UTF-8 

Mobile Applications Questions

wrong year
wrong year  hello I m using the following code: NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df setDateFormat:@"yyyy"]; NSDate *date... wrong year..   I think u are using other calendar Check Settings 

Java Beginners

What is wrong with this line
What is wrong with this line  What is wrong with this line JOptionPane.showMessageDialog(null? for Using Lewandowski's Savings pgrm!"); from if (input.equals("exit") || input.equals("Exit")) { JOptionPane.showMessageDialog 

Java Beginners

what is wrong with this program
what is wrong with this program  import java.io.*; class Distance { int feet,inch; void read() { System.out.println("Enter distance in feet and inches "); feet=Integer.parseInt(ob.readLine()); inch 

Java Beginners

What is wrong with my servlet?
What is wrong with my servlet?  I'd like to know which part of the code is wrong. My code is: print("code sample"); import java.util.*; import java.io.IOException; import java.io.PrintWriter; import 

Java Beginners

what is wrong in this program
what is wrong in this program  import java.io.*; class Distance { int feet; int inch; void read(int feet, int inch) { System.out.println("Enter distance in feet and inches "); feet=Integer.parseInt(ob.readLine 

Java Beginners

what is wrong in this program......
what is wrong in this program......  program to implement given inheritance import java.io.*; class Student { int rno; String name; DataInputStream ob = new DataInputStream(System.in); void getRoll 

Java Beginners

java - Java Beginners
java  public static void Trial(File file) { RandomAccessFile input = null; whats wrong in it? String line = null; try { input = new RandomAccessFile(file, "r"); while ((line 

Java Beginners

java code - Java Beginners
java code  Write a program that performs flashcard testing of simple mathematical problems. Allow the user to pick the category. Repetitively... is right or wrong for each problem, and display an ongoing score. You must use 

Java Beginners

pava program - Java Beginners
problem. public class LeapYear { public static void main (String[] args.... http://www.roseindia.net/java/ Thanks 

Struts Questions

error cannot access class com.opensymphony.xwork2.ActionContext, wrong version
error cannot access class com.opensymphony.xwork2.ActionContext, wrong version  Error(1,32): cannot access class com.opensymphony.xwork2.ActionContext; class file has wrong version 49.0, should be 45.3 or 46.0 or 47.0 or 48.0 

Java Beginners

java - Java Beginners
This will be the answer ......  Sorry .. Last answer was wrong ... lime 

Java Beginners

Java code - Java Beginners
Java code  My Question is... In this there is Textfield... the keyboard. The alphabet is wrong or right that we have to check after clicking check... place.Will you please check it what is wrong in that. private void 

Java Beginners

XML in JAVA - Java Beginners
in another file to get all the elements in the documents.. but my java SDK(i.e Eclipse) gives Java Null Pointer exception... can anyone tell me what could be wrong 

Java Beginners

java - Java Beginners
the factorial of a number then your code is totally wrong. It is giving 

Java Beginners

NEW IN JAVA - Java Beginners
); System.out.println("Wrong="+w1); if(r1>7){ System.out.println...++; } } System.out.println("Right="+r2); System.out.println("Wrong="+w2); if(r2>7...); System.out.println("Wrong="+w3); if(r3>7){ System.out.println("Congratulations 

SQL Question

Sql aggregate function with left join wrong output
Sql aggregate function with left join wrong output    I have three tables Stock,InwardEntry,IssueToProd. Part_no in stock is a primary key... I ma getting wrong sum values of i.InvoiceQuantity,p.IssueQuantity column 

SQL Question

Sql aggregate function with left join wrong output
Sql aggregate function with left join wrong output    I have three tables Stock,InwardEntry,IssueToProd. Part_no in stock is a primary key... I ma getting wrong sum values of i.InvoiceQuantity,p.IssueQuantity column 

SQL Question

Sql aggregate function with left join wrong output
Sql aggregate function with left join wrong output    I have three tables Stock,InwardEntry,IssueToProd. Part_no in stock is a primary key... I ma getting wrong sum values of i.InvoiceQuantity,p.IssueQuantity column 

Java Beginners

throws IOException - Java Beginners
, Most methods of IO class throw an IOException if anything goes wrong...://www.roseindia.net/java/exceptions/ http://www.roseindia.net/help/java/i/java-ioexception.shtml http://www.roseindia.net/tutorial/java/scjp/part2/question4.html Thanks 

Java Beginners

JAVA Error - Java Beginners
JAVA Error  i have made my own calculator GUI..and i want the text... variable red. is it the variable wrong or the code itself is wrong..can you give me...: http://www.roseindia.net/java/ Thanks.   Hello Just use 

Java Interview Questions

Beginners in Java
Beginners in Java  Hi, I am beginners in Java, can someone help me... tutorials for beginners in Java with example? Thanks.   Hi, want to be command over Java, you should go on the link and follow the various beginners 

Java Beginners

java exercise - Java Beginners
java exercise  Pizza ordering program on Java! #write a program... ur's was wrong selection"); } else if(choice==2) { System.out.println..."); cost_of_pizza=60; } else System.out.println("Sorry ur's was wrong 

Java Beginners

Hello World - Java Beginners
Hello World  Java Beginner - 1st day. Looked at the Hello World......){ System.out.println("Hello World!"); } } what am I doing wrong. Am I expecting... for more information.http://www.roseindia.net/java/learn-java-in-a-day 

Java Beginners

swings - Java Beginners
Exception in thread "main" Exception in thread "main" Java Result: 1 BUILD SUCCESSFUL... it.  Hi Friend, It seems that either you have saved your java file with wrong name or you have saved your file in wrong package.Please check whether 

Java Beginners

Not sure whats wrong with my code HELP PLEASE?!?!
Not sure whats wrong with my code HELP PLEASE?!?!  I cant figure out what I am doing wrong in my code can anyone help me out??? Grades function computeGrade( ) { var hw, lab, midt, fin, avg; hw = parseFloat 

Java Beginners

java beginners - Java Beginners
the following links: http://www.roseindia.net/java/beginners/StringTokenizing.shtml http://www.roseindia.net/java/beginners/tokenizingjavasourcecode.shtml...java beginners  what is StringTokenizer? what is the funciton 

Java Beginners

Java program? - Java Beginners
Java program?  In order for an object to escape planet's.... The escape velocity varies from planet to planet.Create a Java program which... formula is getting me the wrong ans. so please help  Hi Abhishek Sisodia 

Java Beginners

java swings - Java Beginners
java swings  Hi, I need the sample code for Jtext box validation. I have the text box,if i enter the wrong input the validation error message is display the textbox right side. Please send the sample code for this... very 

Java Beginners

javaException - Java Beginners
" java.lang.OutOfMemoryError: Java heap space what does it mean?? how can i solve it. pls help me... in wrong way Thanks Rajanikant 

Java Beginners

abt java - Java Beginners
abt java   hiiiii i m new to this language i have some problem with my java code ... i working on netbeans .. i write a code for user... clickin on jar file it gives wrong out put and says certificate is tempered .. i 

JSP Servlet Questions

what is wrong with my JSP codes for updating a form?
what is wrong with my JSP codes for updating a form?  Hi experts, I have tried to emulate a code from a textbook but it doesn't work in my program. Hope someone can advise me where I had gone wrong. Tks. I've set up my 

Java Beginners

Java.. pls. - Java Beginners
Java.. pls.  Hi, sir. it compiler but when search or purchase it didt go true. Sir, can u help me sir. Please Sir.. Import java.io.*; public...; break; default: System.out.print("Wrong Info. Please Enter Again 

Java Beginners

according to me its ok but is calculating wrong values in
according to me its ok but is calculating wrong values in   program to calculate roman numbers .....i.e roman number calculator import java.util.*; import java.io.*; class romancalci { public static void main(String 

Java Beginners

Radio Buttons - Java Beginners
this problem.please send the codes. If the questinaire page, the answer is wrong then make 

Java Beginners

login page - Java Beginners
login page  I have one login page in jsp that is login.jsp. Now i have validate user from database by another page validate.jsp. but if the user feeded wrong information then i want to print error massege on the first page 

Java Beginners

java multidimensional array - Java Beginners
java multidimensional array  i have two arrays which will take numbers and no. of rows and columns fron method getArr() ifter that i want to ensure... ("Error in dimensions"); } I'm getting ArrayOutOfBound exception is any wrong 

Java Beginners

plz help me - Java Beginners
plz help me  Deepak I can write a sessioon code plz help me admin_home.jsp page is display but data is not disply plz help me what is wrong 

Java Beginners

Java - Java Beginners
Java  What could be wrong with this code please import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.border.*; class Billing extends JFrame{ JLabel l1,l2,l3,l4,l5,l6,lPhoto,lN 

Java Beginners

multiple inheritance - Java Beginners
multiple inheritance  Why java does not support Multiple Inheritance?  First of all the question is wrong the correct one is......... Q)why java classes does not support Multiple Inheritance? JAVA CLASSES ONLY 

Java Beginners

j2me with xml - Java Beginners
bin.EventList 2- Class loading error: Wrong name.... Build failed i follow all 

Java Beginners

Javascript validation - Java Beginners
true; alert('Selected file is of the wrong type.Select another one 

Java Beginners

OOP - Java Beginners
. This is my code.Though I know most of it is wrong. import java.util.*; public 

Java Beginners

Java for beginners
Java for beginners  Java for beginners Which is the best resource... Java video tutorial for beginners. Thanks   Hi, Here are the best resources for Learning Java for beginners: Java Video tutorial Java tutorials 

Java Beginners

login authentication - Java Beginners
and java bean. cud u pls help me. here is the bean and jsp code samples. after giving user name and pwd in the jsp page, though it is wrong the jsp page shows to successloging java bean code -------------- public void 

Java Beginners

Java Memory Leak - Java Beginners
Java Memory Leak  I am having a memory leak in my java version of the game Snake. I have narrowed the exact step of when the program memory... , currentSize.height, null); startingBackground (spelled wrong in my code 

Java Beginners

java beginners doubt!
java beginners doubt!  How to write clone()in java strings 

Java Beginners

programming - Java Beginners
programming for java beginners  How to start programming for java beginners 

Java Beginners

Java for beginners - Java Beginners
://www.roseindia.net/java/beginners/index.shtml Thanks...Java for beginners  Hi! I would like to ask you the easiest way to understand java as a beginner? Do i need to read books in advance 

Java Beginners

code problem - Java Beginners
; } else System.out.println("Wrong, try again 

Java Beginners

javascript cookie - Java Beginners
javascript cookie  hi all, i wanted to know how to set expire attribute of cookie in javascript. heres the code : document.cookie = 'cookie2=Second_cookie'; expires=Mon, 17-Aug-09 04:42:00 GMT; path="/"'; whats wrong 

Java Beginners

stack - Java Beginners
on Stack visit to : Thanks   http://www.roseindia.net/java/example/java/util/ Thanks  I think there is bit wrong in the above answer 

Java Beginners

Good tutorials for beginners in Java
Good tutorials for beginners in Java   Hi, I am beginners in Java... in details about good tutorials for beginners in Java with example? Thanks.   ... the various beginners tutorials related to Java http://www.roseindia.net/java/beginners 

Java Beginners

Java Compiler Error - Java Beginners
Java Compiler Error  I get this error when i compile this Java inheritance OOP. What I'm i doing wrong. F:\Java\WorkerDemo.java:9: cannot find symbol symbol : constructor ProductionWorker(java.lang.String) location: class 

Java Beginners

error detection - Java Beginners
error detection   Hi Amardeep and all friends out there could you pls tell me whats wrong with my codes shown down on this page, i tried to create a queue using a linkedlist, but when i tried to run them they are giving 

Java Beginners

PaySlip - Java Beginners
//if wrong show error message //else Vector allEmployees 

Java Beginners

java compilation error - Java Beginners
java compilation error  Hello, I sent a previous message regarding... because I figured out I had the codes typed in wrong. After I corrected... in java graphics to be able to save it as a file if so, how can I do 

Java Beginners

Java programming 1 - Java Beginners
Java programming 1  hi there, Sir! Can u help me check where my program gone wrong? here are my coding =D, hope to get reply from u guys soon..^^ import javax.swing.JOptionPane; class TestMark { private static void 

Java Beginners

Java Compilation error - Java Beginners
Java Compilation error  What's wrong with this: public enum RockPaperScissors { ROCK ("Rock crushes scissors."), PAPER ("Paper covers rock."), SCISSORS ("Scissors cuts paper."); private String mgs; private 

Java Beginners

SUBSET ARRAY. - Java Beginners
in the end of the program. Please Do check where im wrong and how can i do 

Java Beginners

java plus database - Java Beginners
java plus database  kathmandu Sports Club In order to have more... (if any). If the user enters a wrong sport-id, the system must print an error.... Module diagram 4. Java-program   Hi friend, Code to solve 

Java Beginners

Java - Java Beginners
Java  how to declare arrays   Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/array.shtml Thanks 

Java Beginners

an error - Java Beginners
an error  Hi everyone ? pls i tried to run my following codes but i detect an error after trying to compile and run them,howevre i can't find out where i made a mistake,thus pls try to find it and help me where i have gone wrong 

Java Beginners

Java compilation error - Java Beginners
Java compilation error  I place the following code in to my program... - fullFileName.append(vendorID) vendorID is a parameter. What am I doing wrong. public void... in qshell - javac -classpath /home/java/build/ ServiceLevelReport1.java */ public 

Java Beginners

beginners questions
beginners questions  I need all the possible Java beginners questions to prepare for an Interview 

Java Beginners

else if (selection = * 'M'); - Java Beginners
doing wrong :( public class Calculate { public static void main(String 

Java Beginners

basic java - Java Beginners
basic java  oops concept in java ?  Hi Friend, Please visit the following links: http://www.roseindia.net/java/beginners/oop-in-java.shtml http://www.roseindia.net/java/learn-java-in-a-day/oops.shtml Thanks 

Java Beginners

GUI - Java Beginners
GUI  whats wrong with my code? import javax.swing.*; import java.awt.event.*; import java.awt.*; class prog3 extends JFrame { JLabel lbl,lbl1,lbl2,lbl3,lbl4,lbl5,lbl6,lbl7,lb18,lbl9,lbl10,lbl11,lbl12; JTextField 

Java Beginners

GUI - Java Beginners
GUI  whats wrong with my code failed to compile // Department interface //import java.sql.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; class EmployeeInformation extends JFrame implements 

Java Beginners

java - Java Beginners
java  ...can you give me a sample program of insertion sorting... with a comment,,on what is algorithm..   Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/arrayexamples 

Java Beginners

reply me its urgent - Java Beginners
urgent.  hi friend, i think password is wrong or username may be wrong 

General

Java error java.lang.noclassdeffounderror
Java error java.lang.noclassdeffounderror  ... noclassdeffounder occurred in a code when the programmer write a wrong class name... in understanding a java.lang.noclassdeffounder.For this we have a class name 'java 

Java Beginners

Reference type Vs Object type. - Java Beginners
/beginners/oop-in-java.shtml http://www.roseindia.net/java/java-tips/oop/oop.... They never contain the object. C++ object variables may be either, but Java supports only object references. For Example : Book bookvar = new Book("Java 

JSP Servlet Questions

Wrong parameter values while exporting data from jsp to excel
Wrong parameter values while exporting data from jsp to excel   This is a jsp report. When i export the report data to an excel, the parameter values on the html report do not match those in the downloaded spreadsheet 

Java Beginners

java - Java Beginners
java  HOW AND WHERE SHOULD I USE A CONSTRUCTOR IN JAVA PROGRAMMING???   Hi Friend, Please visit the following links: http://www.roseindia.net/java/beginners/Construct.shtml http://www.roseindia.net/java/java 

Java Beginners

java - Java Beginners
links: http://www.roseindia.net/java/java-conversion/DecimalToBinary.shtml http://www.roseindia.net/java/beginners/DataConversion.shtml Thanks...java  write a java program that will read a positive integer 

Java Beginners

Any one can help me? - Java Beginners
Any one can help me?  CAN any of u help me to do this java codes... will be deducted for each wrong answer. The user will be given three chances to correct the answer if he/she goes wrong. Once the user completes the jumbled names 

Java Beginners

urgent-Exception in Tomcat - Java Beginners
; Hi Friend, It seems that you have used wrong 

Java Beginners

Tutorial For Java beginners
Tutorial For Java beginners  I am beginners in Java. Is there any good tutorial and example for beginners in Java? I want to learn Java before Jan... of December 2013. Check the Java Beginners Java Tutorial section for tutorials 

Java Beginners

java downloads - Java Beginners
information. http://www.roseindia.net/java/beginners/download_jdk.shtml...java downloads  hi friends, i would like to download java1.5 .so if possible please send the link for java1.5 free download  Hi friend 

Java Beginners

java - Java Beginners
java  hi!! i want 2 download jdk latest version so can u pls send me the link..?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/download_jdk.shtml Thanks 

Java Beginners

Compute the image processing - Java Beginners
Compute the image processing  Hi, Question 1: I have some questions here first I need some suggestion - I cannot find what went wrong with my...); } } else { System.err.println("usage: java enlarge 

Java Beginners

java beginners - Java Beginners
java beginners   pl. give few example program of signed and unsigned integer bye 

Java Beginners

Java--Xml Modify Node Value - Java Beginners
Java--Xml Modify Node Value  I have the following xml. test_final_1 2009-025T13:23:45 B2B . I want to retrieve the values... the element name inside the for loop...I am going wrong in the following lines 

Java Beginners

how to get the next option - Java Beginners
for you. Thanks  Hi Friend, Sorry,we have provided you wrong link 

Java Beginners

ROTATE THE VOWELS IN A STRING!!! - Java Beginners
cannot see where im going wrong. I think theres a mistake either in "rotateChar 

Java Beginners

Program - Java Beginners
Program Java link list  I need program in Java to copy a file to another file  Hi Friend,For more informationhttp://www.roseindia.net/java/beginners/linked-list-demo.shtml 

Java Beginners

java beginners - Java Beginners
java beginners   pl. tell me in System.out.print() what is System , what is out , print is method name . is System is a package of class name thanks   Hi Friend, System: It is a standard java class 

Java Beginners

java beginners - Java Beginners
java beginners  pl. let me know the answers of the following questions : 1) A program is unable to create objects of a class declared globally. what could be the problem wtih this construcotr 2) what is the benefit 

Java Beginners

java beginners - Java Beginners
java beginners   pl. let me know how to exterat the decimal numbers from a number i want a java program for it Example if input 12.453 OUTPUT 12 .453 if input 25.7657 OUTPUT 25 

Java Beginners

Java basics - Java Beginners
://www.roseindia.net/java/beginners/Varconstltr.shtml for more code and examples on Java...literals in java program  Why we use literals in java program?  Hello,A literal is the source code representation of a fixed value 

Java Beginners

java beginners - Java Beginners
java beginners  pl. let me know the java program to get the following patteren pl. can i I get it today itself . thank you regargd a a a a a a a a a a a a a and the bewlow 

Java Beginners

java beginners - Java Beginners
java beginners   let me know the java code for the followign patteren *00 **0 *** **0 *0 0 means space whereever the stars are there that is the pattern   class user { public static void main(String 

Java Beginners

java beginners - Java Beginners
java beginners   the patteren u received is not the actual patteren which i need the program i don't know why the patteren does not reach in proper formate to you . it was in upside down triangle form . at the top 

Java Beginners

java beginners - Java Beginners
java beginners   Q. 1 How is class related to data abstraction? Q. 2 what is the relationship between a class and an object? thanks  Hi Friend, 1)Data Abstraction is used to hide certain details that we 

Java Beginners

java beginners - Java Beginners
java beginners   what are real constant? give some example of real constant. which of the following is the valid real constant. 2.0, -16.0, +15/2, 1.9E, 189.E4, 0.67E3.6  Hi Friend, A real constant is a real 

Java Beginners

java beginners - Java Beginners
java beginners  please let me know what is the difference between signed and unsigned integer thanks regards bhavna   Hi Friend, Differences: 1)Signed integer can be a negative number whereas 

Java Beginners

java beginners - Java Beginners
java beginners  thanks for the suggestion so I am sending the patteren in place of dots i want blank space aaaaaaaaaaaaaaaa a............a a........a a.....a a...a a thanks 

Java Beginners

java beginners - Java Beginners
java beginners  the pattern was not in this format * * * * * * * * * * * * * * * * it is like this * * * * * * * * * * * * * * * * thanks   Hi Friend, If you want the following 

Advertisements Advertisements
 

 

 

DMCA.com