CodeGym /Courses /Java Collections /Tasks | Level 2 | Lesson 4

Tasks | Level 2 | Lesson 4

Java Collections
Level 2, Lesson 4
Available
14
Task
Java Collections, level 2, lesson 4
Locked
Reading from a stream
Reading from a stream
14
Task
Java Collections, level 2, lesson 4
Locked
Writing a stack trace
Writing a stack trace
14
Task
Java Collections, level 2, lesson 4
Locked
Caesar cipher
Caesar cipher
Comments (7)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Hoist Level 1, San Diego, United States
11 January 2024
Output java.lang.IndexOutOfBoundsException: fff at com.codegym.task.task32.task3203.Solution.main(Solution.java:14) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)
Максим Василенко Level 44, Kiev, Ukraine
11 March 2023
Can somebody explain me why we should use byte[] buffer = new byte[1024] and write throw ByteArrayOutputStream insead of while( inputStream.isAvailable() > 0) writer.write()? I hope I wrote clearly))
Skynet Level 40, USA
8 August 2021
Hint for "Reading from a stream": Check if variable 'is' is null, then if true return a new StringWriter() object. Else use one of the faster options to read from the stream provided on this page. Write the result to the StringWriter and return it.
Andrei Level 1
21 June 2021
These were good exercises, challenging but not impossible. Even though I wasn't able to solve them on my own, the journey helped me better understand the concepts.
Andrei Level 1
21 June 2021
P.S. Unlike some of the other exercises' solutions, these ones I could understand and made sense after reading.
Wei Cui Level 39, Newark, United States
19 March 2020
Skynet Level 40, USA
8 August 2021
As of Aug 2021, it's now the second task.