Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Idea How to add interface implementation to classes?

For example I have many classes than implement my interface. After adding new method definition in the interface, how can I fast-add blank interface implementations for all that classes?

like image 481
Jack Avatar asked Jan 18 '13 14:01

Jack


1 Answers

You can generate an implementation of an interface by moving the caret to the name of the interface and pressing option+return (on Mac) or ALT+Enter (on PC), then hovering over Implement interface and pressing return/Enter:

Implement interface Please note that my caret can't be seen but it's between the h and a of Shape

IntelliJ will then prompt you for a class name and which methods to include in the implementation, then generate a class, like this:

enter image description here

like image 101
sleighty Avatar answered Sep 19 '22 05:09

sleighty