Question: Strings batch 1 , batch 2 , and batch 3 are read from input. Each string consists of three foods, separated by +
Strings batch batch and batch are read from input. Each string consists of three foods, separated by and surrounded by and Assign secondItems with the second food from each string, separated by
Ex: If the input is:
celerycerealcarrot
apricotmilkoatmeal
peasgarlicpeach
then the output is:
cerealmilkgarlic import java.util.Scanner;
public class JoinMultipleSeconds
public static void mainString args
Scanner scnr new ScannerSystemin;
String batch;
String batch;
String batch;
String secondOfBatch;
String secondOfBatch;
String secondOfBatch;
String secondItems;
batch scnrnextLine;
batch scnrnextLine;
batch scnrnextLine;
Your code goes here
System.out.printlnsecondItems;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
