I have this program that i need to be able to take multiple integers(in this case years) from the user. So far the program works with just one integer. I need the program to be able to take in multiple years seperated by a space in one line of input.
thanks in advance!
import java.util.Scanner; public class GregorianCalendar { public static void main (String[] args) { Scanner scan = new Scanner(System.in); int year; System.out.print("Enter the year: "); year = scan.nextInt(); if (year < 1582){ System.out.println("Error; year invalid"); System.exit(0); } if (year % 4 == 0) { if (year % 100 != 0) { System.out.println(year + " is a leap year"); } else if (year % 400 == 0) { System.out.println(year + " is a leap year"); } else { System.out.println(year + " is not a leap year"); } } else { System.out.println(year + " is not a leap year"); } } }