- #1
- 86
- 0
Let's say a method or constructor has multiple parameters example in DecimalFormat --
public final StringBuffer format(double number,
StringBuffer toAppendTo,
FieldPosition pos)
if you don't declare all of the parameters, what happens to those that are not declared?
for example
DecimalFormat dec = new DecimalFormat("0.##");
String convert = dec.format(1.3588); //double number parameter is declared
here the parameters StringBuffer toAppendTo, FieldPosition pos are not declared. what happens to these?
Is it applicable to both methods and constructors? Any cases where it will return an error?
(do keep it simple because I am just doing an intro course)
Edit : It has something to do with inheritance, someone explain in simple terms thanks!
public final StringBuffer format(double number,
StringBuffer toAppendTo,
FieldPosition pos)
if you don't declare all of the parameters, what happens to those that are not declared?
for example
DecimalFormat dec = new DecimalFormat("0.##");
String convert = dec.format(1.3588); //double number parameter is declared
here the parameters StringBuffer toAppendTo, FieldPosition pos are not declared. what happens to these?
Is it applicable to both methods and constructors? Any cases where it will return an error?
(do keep it simple because I am just doing an intro course)
Edit : It has something to do with inheritance, someone explain in simple terms thanks!
Last edited: