How can I pass a string from one method to another using TestNG?
<p>In my tests I am to capture a string in one method and then later use it in a different method. Here is an example of what I am trying to do:</p>

<pre><code>public class stackOverflowExample {

public static WebDriver driver;
public static Properties OR = null;

@Test
public void test_1() throws InterruptedException {

System.setProperty("webdriver.ie.driver","D:\\iedriver\\IEDriverServer.exe");               
driver=new InternetExplorerDriver();


 driver.get("http://www.google.com");

Thread.sleep(1500);

String string1 = driver.findElement(By.id("btnK")).getText();

System.out.println(string1);

}

public void test_2() {

  System.out.println(string1);


}
}
</code></pre>

<p>How can I use string1 in the test_2() method?</p>

<p>*Edit: </p>

<p>For clarity of why I am trying to do this, I am running a test that does the following:</p>

<ol>
<li>Logs into website under User1</li>
<li>Creates a new mortgage application</li>
<li>Logs out of User1, then logs back in under User2</li>
<li>User2 would then open up the newly created mortgage application and run various test scenarios.</li>
</ol>