Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 14th, 2012  |  syntax: None  |  size: 0.54 KB  |  views: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import javax.swing.JOptionPane;
  2.  
  3. public class Proj8
  4. {
  5.         public static void main(String[] args)
  6.         {
  7.                
  8.                 String input = JOptionPane.showInputDialog("Enter the year:");
  9.                 int year = Integer.parseInt(input);
  10.                 if(year%4 == 0)
  11.                 {
  12.                         System.out.println(year + " is a leap year.");
  13.                         if(year%100 == 0)
  14.                         {
  15.                                 System.out.println(year + " is not a leap year.");
  16.                                 if(year%400 == 0)
  17.                                 {
  18.                                         System.out.println(year + " is a leap year.");
  19.                                 }
  20.                         }
  21.                 }
  22.                 else
  23.                 {
  24.                         System.out.println(year + " is not a leap year.");
  25.                 }
  26.                
  27.         }
  28. }
clone this paste RAW Paste Data