Create a class that holds three initialized StringBuilder objects: your first na
ID: 3650411 • Letter: C
Question
Create a class that holds three initialized StringBuilder objects: your first name, middle name, and last name. Create three new StringBuilder objects as follows:An object named entireName that refers to your three names, separated by spaces
An object named lastFirst that refers to your last name, a comma, a space, and your first name, in that order
An object named signature that refers to your first name, a space, your middle initial ( not the entire name), a period, a space, and your last name Display all three objects.
Explanation / Answer
Please rate...
Program SBuilder.java
=============================================================
class SBuilder
{
public static void main(String args[])
{
StringBuilder s1,s2,s3;
s1=new StringBuilder("John");
s2=new StringBuilder("Abraham");
s3=new StringBuilder("Smith");
StringBuilder entireName,lastFirst,signature;
entireName=new StringBuilder(s1+" "+s2+" "+s3);
lastFirst=new StringBuilder(s3+", "+s1);
signature=new StringBuilder(s1+" "+s2.charAt(0)+". "+s3);
System.out.println("Entire Name: "+entireName);
System.out.println("Last First: "+lastFirst);
System.out.println("Signature: "+signature);
}
}
=============================================================
Sample output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.