CodeGym /Courses /Java Core /Practice with streams | Level 9

Practice with streams | Level 9

Java Core
Level 9 , Lesson 8
Available

"Hello, Amigo!"

12
Task
Java Core, level 9, lesson 8
Locked
Reader wrapper
Replace the main method's System.out object with your own reader wrapper similar to the one shown in the lesson. Your reader wrapper should convert all text to uppercase letters. Call testString's existing printSomething() method. Restore the System.out variable back to the original stream. Display
6
Task
Java Core, level 9, lesson 8
Locked
Reader Wrapper 2
Replace the main method's System.out object with your own reader wrapper similar to the one shown in the lesson. Your reader wrapper should replace all "te" substrings with "??". Call testString's existing printSomething() method. Restore the System.out variable back to the original stream. Display
6
Task
Java Core, level 9, lesson 8
Locked
Output only digits
Replace the main method's System.out object with your own reader wrapper similar to the one shown in the lesson. Your reader wrapper should output only digits. Call testString's existing printSomething() method. Restore the System.out variable back to the original stream. Display the modified string
12
Task
Java Core, level 9, lesson 8
Locked
Problem solving
Replace the main method's System.out object with your own reader wrapper similar to the one shown in the lesson. Your reader wrapper should output the solution to the console. Call testString's existing printSomething() method. Restore the System.out variable back to the original stream. Possible o
12
Task
Java Core, level 9, lesson 8
Locked
Duplicate text
Read a file name from the console. Replace the main method's System.out object with your own reader wrapper similar to the one shown in the lesson. Your reader wrapper must output all text to both the console and a file whose name you have read. Call testString's existing printSomething() method. Re
Comments (11)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Thành Black Level 49, Hanoi
4 October 2021
That taks is not at the same time!
Ian De Bie Level 28, Austin, United States
21 October 2020
i just used a string to capture the output and then for the fileoutputstream you can call getBytes() on your string, easy peazy...
MaGaby2280 Level 41, Guatemala City, Guatemala
31 March 2020
The last one was hard... be aware of the order of commands and converting to byte[]... and than writing it to the fileoutputStream and the console...
Henrique Level 41, São Paulo, Brazil
1 July 2020
I only thought about using the "toByteArray()" method because of your comment, and it passed. Thanks!
Andrei Level 41
5 February 2021
or when you write to the outputstream you can use getBytes() for the string. Even simpler!
Tian Pro Level 23, Cape Town, South Africa
19 February 2020
Last task seems impossible </3
Delonius Level 20, Port Saint Lucie, United States
6 March 2020
If it helps, you can convert the ByteArrayOutputStream to a regular byte[] array by calling outputStream.toByteArray();. From there, you just write from a buffer like you've done a hundred times before in previous levels.
LennyMan Level 25, Lucca, Italy
9 January 2021
I suggest to check on google what you can do with ByteArrayOutputStream, has some interesting methods, i used one for this task.
Hossein Shams Level 1, Atlanta, United States
8 September 2019
Where's "Ewerton"s comment?!!!
Sam Jin Level 23, Cambridge, Australia
16 September 2019
dw mate i'll replace him
Andrei Level 41
5 February 2021
you a'right matey? any kangaroooos aroond gea ?😜