Write a program that prompts for and reads the users first a
Solution
FirstnameLastname.java
import java.util.Scanner;
public class FirstnameLastname {
   public static void main(String[] args) {
       
        //Declaring variables
        String fname,lname,res;
       
        //Scanner object is used to get the inputs entered by the user
        Scanner sc=new Scanner(System.in);
       //Getting the firstname entered by the user
        System.out.print(\"Enter the firstname :\");
        fname=sc.next();
       
        //Getting the lastname entered by the user
        System.out.print(\"Enter the lastname :\");
        lname=sc.next();
       
        /* Concatenating the first character of firstname
        * and first three characters of lastname
        */
        res=fname.charAt(0)+lname.substring(0,3);
       
        //Displaying the result
        System.out.println(\"The result is :\"+res);
       
    }
}
_________________
Output:
Enter the firstname :Kane
 Enter the lastname :Williams
 The result is :KWil
_____________Thank You

