blob: adbbf05e0fc3248e74b8846f107421579b35af4b [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>
Replacing an expression with a method parameter
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
</head>
<body>
<h1> Replacing an expression with a method parameter </h1>
To replace an expression with a method parameter:
<ul>
<li> In the Java editor, select the expression</li>
<li> Do one of the following:
<ul>
<li> From the menu bar, select <strong>Refactor &gt; Introduce Parameter</strong> or </li>
<li> From the editor's pop-up menu, select <strong>Refactor &gt; Introduce Parameter</strong> </li>
</ul>
</li>
</ul>
<p>
The highlighted expression will be replaced with a reference to a new method parameter.
Callers of the method will be updated to pass the expression as the value of the new parameter.
</p>
<p>
<strong>Note:</strong> this refactoring may result in non-compiling code if the highlighted
expression explicitly or implicitly references <code>this</code>.
</p>
<img src="../images/ngrelr.png" alt="Related reference" border="0" > <br>
<a href="../reference/ref-menu-refactor.htm">Refactoring actions</a> <br>
<a href="../reference/ref-117.htm">Refactoring dialogs</a> <br>
<a href="../reference/ref-13.htm">Java preferences</a>
</body>
</html>