I'm a little confused to how one declares a property for a class in java and I'm not seeming to wrap my head around with the google searches either.
Right now I have a class:And these variables I would like to make public properties:Code:public abstract class LoanBaseClass { private double m_InterestAmount; private double m_MonthlyPayment; private double m_TotalLoan; private double m_LoanAmount; private int m_NumYears; public LoanBaseClass(){ m_LoanAmount = 0.0; m_NumYears = 0; } public LoanBaseClass(double LoanAmount, int NumYears){ m_LoanAmount = LoanAmount; //Need to use property instead m_NumYears = NumYears; //Need to use property instead } public abstract void CalcLoan(); public abstract void CalcLoan(double LoanAmount, int NumYears); }There is some validation in the SET part that I need to do.Code:private double m_InterestAmount; private double m_MonthlyPayment; private double m_TotalLoan; private double m_LoanAmount; private int m_NumYears;




Reply With Quote