Java Write an executable program that has just a main method. In main: create an instance of StringBuilder that initially holds an empty string. append your first name to the string. append your surname to the string. display your name. insert your middle initial where it should be and spaces as needed. If you don't have a middle name, fake it. display your name with middle initial. delete your initial and the space(s). display your name in reverse order. SAMPLE OUTPUT John Public John Q Public cilbuP nhoJ
Java Write an executable program that has just a main method. In main: create an instance of StringBuilder that initially holds an empty string. append your first name to the string. append your surname to the string. display your name. insert your middle initial where it should be and spaces as needed. If you don't have a middle name, fake it. display your name with middle initial. delete your initial and the space(s). display your name in reverse order. SAMPLE OUTPUT John Public John Q Public cilbuP nhoJ
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
Related questions
Question
Java
Write an executable program that has just a main method. In main:
- create an instance of StringBuilder that initially holds an empty string.
- append your first name to the string.
- append your surname to the string.
- display your name.
- insert your middle initial where it should be and spaces as needed. If you don't have a middle name, fake it.
- display your name with middle initial.
- delete your initial and the space(s).
- display your name in reverse order.
SAMPLE OUTPUT
John Public
John Q Public
cilbuP nhoJ
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
Step 1: Introduction
In main function:
- create an instance of StringBuilder that initially holds an empty string.
- append your first name to the string.
- append your surname to the string.
- display your name.
- insert your middle initial where it should be and spaces as needed. If you don't have a middle name, fake it.
- display your name with middle initial.
- delete your initial and the space(s).
- display your name in reverse order.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT