What are the shortcut to Auto-generating toString Method in Eclipse?

Eclipse 3.5.2 (and possibly earlier versions) already provides this feature. If you right-click within the editor, you’ll find it under Source -> Generate toString()…

To answer your question about whether it’s a bad practice to autogenerate toString(), my opinion is that it is not. If the generated code is very similar to the code you would have written yourself, then why bother typing it out?

Leave a Comment