Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Strings name 1 , name 2 , and name 3 are read from input. Each string represents a list of name ( s ) surrounded
Strings name name and name are read from input. Each string represents a list of names surrounded by and
Assign combinedNames with the concatenation of name name and name in the order read.
Assign groupOfAll with a string that contains all the names in name name and name in the order read, separated by and surrounded by and
Ex: If the input is:
then the output is:
All groups in one line:
One group of all names:
import java.util.Scanner;
public class JoinMultipleFields
public static void mainString args
Scanner scnr new ScannerSystemin;
String name;
String name;
String name;
String combinedNames;
String groupOfAll;
name scnrnextLine;
name scnrnextLine;
name scnrnextLine;
your input
System.out.printlnAll groups in one line: combinedNames;
System.out.printlnOne group of all names: groupOfAll;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started