previous | start | next

## Overriding the `toString` Method

- Format all fields:

      public class Employee
      {
         public String toString()
         {
            return getClass().getName()
               + "[name=" + name
               + ",salary=" + salary
               + "]";
         }
         ...
      }

- Typical string:

      Employee[name=Harry Hacker,salary=35000]

previous | start | next