0

So I am fairly new at using Java. But here is the issue I need help with.

I am currently at run time storing a value of a "First Name" field Then storing a value of the "Last Name" field.

I need to make those two value to be stored as a single variable example "James Willard" Note must have a space between the two values.

I need this put together like this to insert into a single Signature box. Currently I have two methods one for each value. Is there a way to put this into one method?

Below is my current methods I have. Any help would be greatly appreciated.

//Method to Capture First Name for Signature block on Review and Sign 
Page
public String getFirstName() {
    String FName= FirstName.getAttribute("value");
    System.out.println("FirstName in method"+FName);
    return FName;
}

//Method to Capture Last Name for Signature block on Review and Sign 
Page
public String getLastName() {
    String LName= LastName.getAttribute("value");
    System.out.println("LastName in method"+LName);
    return LName;
}
Tom
  • 1,387
  • 3
  • 19
  • 30
Scotty R
  • 13
  • 3
  • er...couldn't you just define `FName` and `LName` in one method, and concatenate them with `FName + " " + LName`? – Mingle Li Jul 21 '17 at 01:13
  • what about making method named getFullName() and get inside it the two values and just print the two values with a space between them. – Fady Saad Jul 21 '17 at 01:18
  • Mingle thanks for the response so I am not familiar with the correct use of the above you provided. So I made an attempt like this String FName= FirstName.getAttribute("value") + " " + LName=LastName.getAttribute("value"); but the LName errors saying cannot resolve to a variable so I'm not sure how exactly I should write this. – Scotty R Jul 21 '17 at 01:32
  • Fady Thanks for the tip I tried as you said after a little trial and error but I now have it working as you had recommended. I truly thank you folks as I am fairly new at this. I appreciate folks helping us less experienced folks get our feet wet so to speak. Thanks again – Scotty R Jul 21 '17 at 02:22
  • @OrangeDog How is that question even remotely a duplicate of this one? – Mark Rotteveel Aug 31 '18 at 16:35

0 Answers0