I have a problem with format()

I was watching Mosh’s java begginer course when I finished the mortage calculator and seen the solution I started fixing mine and I have a problem.
look at the “getCurrencyInstance().format()”

Hi,

Your current line 25 is:
NumberFormat mortgageFormatted = NumberFormat.getNumberInstance().getCurrencyInstance().format();

the reason why you are getting an error is that you are trying to call 2 x functions that sits on the same level. You have to either call:

getNumberInstance()
or
getCurrencyInstance()

The error will go away if you replace line 25 with:
NumberFormat mortgageFormatted = NumberFormat.getCurrencyInstance().format(mortgage);