Question: Strings list 1 and list 2 are read from input. Each string represents a list of color ( s ) surrounded by <

Strings list1 and list2 are read from input. Each string represents a list of color(s) surrounded by "<" and ">".
Assign combinedColors with the concatenation of list1 and list2 in the order read.
Assign groupOfAll with a string that contains all the color(s) in list1 and list2 in the order read, separated by "" and surrounded by "<" and ">".
Ex: If the input is:
then the output is:
All lists in one line:
One list of all colors:
import java.util.Scanner;
public class JoinMultipleFields {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
String list1;
String list2;
String combinedColors;
String groupOfAll;
list1= scnr.nextLine();
list2= scnr.nextLine();
/* Your code goes here */
System.out.println("All lists in one line: "+ combinedColors);
System.out.println("One list of all colors: "+ 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!