Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

add the missing code: Strings group 1 and group 2 are read from input. Each string represents a list of animal ( s ) surrounded

add the missing code: Strings group1 and group2 are read from input. Each string represents a list of animal(s) surrounded by "[" and "]".
Assign combinedAnimals with the concatenation of group1 and group2 in the order read.
Assign everythingList with a string that contains all the animal(s) in group1 and group2 in the order read, separated by "," and surrounded by "[" and "]".
Ex: If the input is:
[bison]
[penguin]
then the output is:
All groups in one line: [bison][penguin]
One group of all animals: [bison, penguin] import java.util.Scanner;
public class JoinMultipleFields {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
String group1;
String group2;
String combinedAnimals;
String everythingList;
group1= scnr.nextLine();
group2= scnr.nextLine();
/* Your code goes here */
System.out.println("All groups in one line: "+ combinedAnimals);
System.out.println("One group of all animals: "+ everythingList);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Finance The Role Of Data Analytics In Manda Due Diligence

Authors: Ps Publishing

1st Edition

B0CR6SKTQG, 979-8873324675

Students also viewed these Databases questions

Question

If f(x) = 2x + In x, find f1(2).

Answered: 1 week ago

Question

5. Describe the visual representations, or models, of communication

Answered: 1 week ago