Okay so, I have to use an interface in a code I’m making involving currency and there are some methods I’ve created with parameters. Question: Does it matter if I create the my interface class with different parameter names than the classes that are implementing it?
For example:
//One of my methods which calculates a US paper currency (created in my interface class)
BigDecimal getUSD(int onepaper, int fiftypaper, int twentypaper, int tenpaper, int fivepaper, int onepaperval);
//One of my classes which contains the getUSD method in it.
public void getUSD(int dollars, int quarters,
int dimes, int nickels, int pennies)
{
payment = dollars + quarters * QUARTER_VALUE + dimes * DIME_VALUE
+ nickels * NICKEL_VALUE + pennies * PENNY_VALUE;
}
Will this create an issue when java runs? (Note this is my first time using interfaces)
It does not matter what you name your variables as long as they are in the same order and of the same type as the interface.