us
is a variable of type (class)NumberFormat
.getCurrencyInstance()
is a static method (a method of the class, not of an object). So this method is not related to a object. But this method generates an object of classNumberFormat
(a kind of factory), that is stored in the variableus
.- now that you have a
NumberFormat
object, you can use it to format thepayment
as a string (following certain rules defined in yourus
object)
solved Explanation for syntax