+An example of this composite refactoring is shown in
+\myref{lst:extractAndMoveMethodRefactoring}. The example joins the examples from
+\cref{lst:extractMethodRefactoring} and \cref{lst:moveMethodRefactoring}. This
+means that the selection consisting of the consecutive calls to the methods
+\method{foo} and \method{bar}, is extracted into a new method \method{fooBar}
+located in the class \type{X}.
+
+\begin{listing}[h]
+ \begin{multicols}{2}
+ \begin{minted}[samepage]{java}
+ // Before
+ class C {
+ void method() {
+ X x = new X();
+ x.foo(); x.bar();
+ }
+ }
+
+ class X {
+ void foo(){/*...*/}
+ void bar(){/*...*/}
+ }
+ \end{minted}
+
+ \columnbreak
+
+ \begin{minted}[samepage]{java}
+ // After
+ class C {
+ void method() {
+ X x = new X();
+ x.fooBar();
+ }
+ }
+
+ class X {
+ void fooBar() {
+ foo(); bar();
+ }
+ void foo(){/*...*/}
+ void bar(){/*...*/}
+ }
+ \end{minted}
+ \end{multicols}
+ \caption{An example of the \ExtractAndMoveMethod refactoring.}
+ \label{lst:extractAndMoveMethodRefactoring}
+\end{listing}