Why cannot I return values from two functions simultaneously in Java? : I can return either getMonth or getYear from the following code. I have tried giving the value of m and y separately in the calculate date function and that works perfectly !!
Any suggestions?
I am a beginner, apologies if there is a trivial mistake, though there shouldn't be according to me.


    import java.util.Scanner;

    public class Second_Java {

	public static int getMonth() {

		int a;
		Scanner sc = new Scanner(System.in);
		System.out.println("Enter the input for the required month: ");
		a = sc.nextInt(); // stored in 'a' locally

		while (a < 1 && a > 12) {

			a = -1;
			System.out.println(a);

		}
		sc.close();
		return a;
	}

	public static int getYear() {

		int b;
		Scanner input = new Scanner(System.in);
		System.out.println("Enter the input for the required year: ");
		b = input.nextInt(); // stored in 'a' locally

		while (b < 1) {

			b = -2;
			System.out.println(b);

		}
		input.close();
		return b;
	}

	public static void calculateDays(int m, int y) {

		switch (m) {
		case 4:
		case 6:
		case 9:
		case 11:
			m = 30;
			System.out.println(m);
			break;
		case 2:
			if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) {
				m = 29;
				System.out.println(m);
			} else {
				m = 28;
				System.out.println(m);
			}
			break;
		default: {
			m = 31;
			System.out.println(m);
		}

		}

	}

	public static void main(String[] args) {

		int m = getMonth();
		int y = getYear();
		calculateDays(m, y);
	}
}
