a) Program to check whether a number is even or odd
Java Program

import java.util.Scanner;

public class EvenOdd
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        System.out.println("Enter a number: ");
        int num = sc.nextInt();

        if (num % 2 == 0)
        {
            System.out.println(num + " is even");
        }
        else
        {
            System.out.println(num + " is odd");
        }
    }
}
b) Program to calculate Factorial of a Number
Java Program

class Factorial
{
    public static void main(String args[])
    {
        int i, fact = 1;
        int n = 5;

        for(i = 1; i <= n; i++)
        {
            fact = fact * i;
        }

        System.out.println("Factorial of " + n + " is: " + fact);
    }
}