I just learned today just a few minutes ago that I can nest a number of static classes within a containing class which I wasn't aware of. I got used with creating classes with no nested classes at all in the past.
I thought that making use of nested classes will help in readability of codes especially when an object or a class has subclasses or types, just like Payment where you need to consider paymentterms.
I find that understanding nested classes and applying it to my coding is very powerful combined with interfaces.
So I tried to apply it to my current project where I design the classes and methods of Payment.
public class Payment {
    public static class terms{
        public static class monthly implements Monthly{
            @Override //error here
            public static void setDownpayment(double aDownPayment) //and error here
            {
            }
        }
        public static class quarterly{
            public static void setDownpayment(){
                //do something
            }
        }
        public static class semestral{
            public static void setDownpayment(){
                //do something
            }
        }
    }
} 
and here's the interface I created
public interface Monthly {
    public void setDownpayment(double aDownPayment);
}
I tried to make the setDownpayment() method to be static so I can refer to it like this:
Payment.terms.monthly.setDownpayment(aDecimalValue);
But it doesn't seem to allow static methods. because there's an error on the 2 lines I commented with "//error here and //and error here"
How do I fix it?
Any other possible solution or alternative ways or design suggestions?
I'd appreciate any help.
Thanks.
 
    