16.5 Defining Methods
The methods of a class are essentially code routines that can be called upon to perform specific tasks within the context of that class.
Methods are declared within the opening and closing braces of the class to which they belong and are declared using the standard Kotlin function declaration syntax.
For example, the declaration of a method to display the account balance in our example might read as follows:
class BankAccount {
var accountBalance: Double = 0.0
var accountNumber: Int = 0
fun displayBalance()
{
println("Number $accountNumber")
println("Current balance is $accountBalance")
}
}