i want to print the first and last name of a person. The question is how can I return both first and last name. Below is my code.
package methodbasics;
import java.util.Scanner;
public class MethodBasics {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter Your FName :");
String firstName = input.nextLine();
System.out.print("Enter Your LName :");
String lastName = input.nextLine();
System.out.printf("Welcome %s %s!!!\n", printName(firstName, lastName));
}
public static String printName(String firstName, String lastName){
return firstName, lastName;
}
}