Question: Strings name 1 , name 2 , and name 3 are read from input. Each string represents a list of name ( s ) surrounded

Strings name1, name2, and name3 are read from input. Each string represents a list of name(s) surrounded by "<" and ">".
Assign combinedNames with the concatenation of name1, name2, and name3 in the order read.
Assign groupOfAll with a string that contains all the name(s) in name1, name2, and name3 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 main(String[] args){
Scanner scnr = new Scanner(System.in);
String name1;
String name2;
String name3;
String combinedNames;
String groupOfAll;
name1= scnr.nextLine();
name2= scnr.nextLine();
name3= scnr.nextLine();
//your input
System.out.println("All groups in one line: "+ combinedNames);
System.out.println("One group of all names: "+ groupOfAll);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!