a) Constructors
Java Program

public class Construct
{
    int x;

    // Create a constructor for the class Construct
    public Construct()
    {
        x = 5;
    }

    public static void main(String[] args)
    {
        Construct myObj = new Construct();
        System.out.println(myObj.x);
    }
}
b) Constructor Overloading
Java Program

public class Box
{
    double width, height, depth;
    int boxNo;

    Box(double w, double h, double d, int num)
    {
        width = w;
        height = h;
        depth = d;
        boxNo = num;
    }

    Box()
    {
        width = height = depth = 4;
    }

    Box(int num)
    {
        this();
        boxNo = num;
    }

    public static void main(String[] args)
    {
        Box box1 = new Box(1);
        System.out.println(box1.width);
    }
}