subject

Write code that inserts userItems into the output string stream itemsOSS until the user enters "Exit". Each item should be followed by a space. Sample output if user input is "red purple yellow Exit":

red purple yellow
import java. util. Scanner;
import java. io. PrintWriter;
import java. io. StringWriter;

public class StringStreamOutput {
public static void main (String [] args) {
Scanner scnr = new Scanner(System. in);
String userItem = "";

StringWriter itemCharStream = new StringWriter();
PrintWriter itemsOSS = new PrintWriter(itemCharStream);

System. out. println("Enter items (type Exit to quit):");
userItem = scnr. next();

while (!userItem. equals("Exit")) {

/* Your solution goes here */

userItem = scnr. next();
}

userItem = itemCharStream. toString();
System. out. println(userItem);

return;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
1.the index finger on your right hand types the f r v 4 j u m 7 h y 6 n lo.9 j u 7 m g t 5 b 2.if you need to multiply 400, 2, and 1 ½, what would you type on the numeric keypad? 400*2*1.5 400/2*1.5 400/2/1.5 400*2*1½ 3.select all examples of proper keyboarding technique. rest your fingers gently on the home row or home keys. slouch in your chair. rest your palms on the keyboard. relax your fingers. keep your hands lower than your elbows.
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
How can you make your column headings stand out?
Answers: 1
You know the right answer?
Write code that inserts userItems into the output string stream itemsOSS until the user enters "Exit...
Questions
question
Arts, 28.01.2021 20:30
question
Mathematics, 28.01.2021 20:30
question
Health, 28.01.2021 20:30
question
Mathematics, 28.01.2021 20:30
question
Mathematics, 28.01.2021 20:30
Questions on the website: 13722367