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