Java Program to Convert a Person Name in Abbreviated

Problem:- Java program to abbreviate a given name or a java program to print short form of a name or Printing the initials of a Name or First letters of each word of a name or Write a Java Program to Convert a person's name in abbreviated or Java Program to Accept a name and print the short form of the name or Print initials of a name or how to find short form of a name in java or a java program to print short form of a name.

Explanation:- Abbreviated or sort name both are same, let's take an example and try to understand a sort name or abbreviated name, I am taking an example of my full name, My full name is " Ghanendra Pratap Singh Yadav " then my Abbreviated or Sort Name will be G. P. S. Yadav. I think now you understand the Abbreviated and sort name now comes to the problem. So for sort name and Abbreviated name as you can see above we have to print the first letter of your first name(in my case that is Ghanendra), and first letter of middle name(in my case that is Pratap Singh) and print the full last name(that is Yadav in my case).

Note:- Most people don't have a middle name so for them print the only first letter of the first name and last name Ie. The name is Ghanendra Yadav then sort name or Abbreviated name will be G. Yadav.

See Also:- C++ Program to Convert a person's name in abbreviated

Java Program to Print Short Form of a Name

import java.util.Scanner;
import java.io.*;
/* Program By Ghanendra Yadav
   Visit http://www.programmingwithbasics.com
class abbreviated 
 public static void main(String[] args) throws IOException 
  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

  System.out.print("\nEnter your Fisrt name:\t");
  char firstname=br.readLine().charAt(0);

  System.out.print("\nEnter middle Name:\t");
  char midname=br.readLine().charAt(0);

  System.out.print("\nEnter your last name:\t");
  String lastname=br.readLine();

  System.out.println("\n Abbreviated Name:\t"+firstname+"."+midname+"."+lastname);

See Also:- C Program to Convert a person's name in abbreviated

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me