Answer:
Following are the program in Java language
import java.util.*; // import package
public class Main // main function
{
public static void main(String[] args) // main class
{
String l_name,f_name; // variable declaration
Scanner sc6=new Scanner(System.in); // scanner class
f_name= sc6.next(); // Read input
l_name=sc6.next(); // Read input
System.out.print(l_name); // display last name
System.out.print(","); // display comma
System.out.println(f_name); // display first name
}
}
Output:
Maya Jones
Jones, Maya
Step-by-step explanation:
Following are the description of program
- Declared a variable 'l_name","f_name" as the string type .
- Create the instance of scanner class i.e "sc6".
- Read the user input by using the instance "sc6" of the scanner class in the variable "l_name" and "f_name ".
- Finally by system.print() method we will display the value according to the format in the given question .