# I have a problem with format()

**URL:** <https://forum.codewithmosh.com/t/i-have-a-problem-with-format/1972>\
**Category:** Java\
**Created:** [January 15, 2021, 10:36am UTC](https://forum.codewithmosh.com/t/i-have-a-problem-with-format/1972 "2021-01-15T10:36:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZakiChel](https://avatars.discourse-cdn.com/v4/letter/z/85e7bf/32.png) [@ZakiChel](https://forum.codewithmosh.com/u/ZakiChel)\
**Post date:** [January 15, 2021, 10:36am UTC](https://forum.codewithmosh.com/t/i-have-a-problem-with-format/1972/1 "2021-01-15T10:36:49Z")

</div>

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()”

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/1X/876c24b253d257d4abdc5ce75057934e446bf51c.png)

---

<div class="post-metadata">

**Author:** ![Benjamin](https://avatars.discourse-cdn.com/v4/letter/b/3d9bf3/32.png) [@Benjamin](https://forum.codewithmosh.com/u/Benjamin)\
**Post date:** [January 22, 2021, 10:03am UTC](https://forum.codewithmosh.com/t/i-have-a-problem-with-format/1972/2 "2021-01-22T10:03:44Z")

</div>

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);
