Best Solution :
If you are using scenario outline:
When user enters username as <username> and password as <password>
Then post login page is displayed with <username>
Examples:
| username|password|
|Kiran|1234|
Step Defination Code:
@When("user enters username as (.*) and password as (.*)")
public void enterLoginDetails(String userName,String password)
{
//You will get userName=Kiran and Password=1234
}
@Then("post login page is displayed with (.*)")
public void postLoginValidation(String userName)
{
//You will be access the same username which is you are passing while login
////You will get userName=Kiran
}