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

Practice with streams | Level 8

Java Core
Level 8 , Lesson 8
Available

"Hello, Amigo!"

10
Task
Java Core, level 8, lesson 8
Locked
Wrapper (Decorator)
Figure out what the program does. By analogy with the DecoratorRunnableImpl class, create a DecoratorMyRunnableImpl class.
10
Task
Java Core, level 8, lesson 8
Locked
Extending AmigoOutputStream
Using the wrapper (decorator) design pattern, extend the functionality of AmigoOutputStream. In the QuestionFileOutputStream class, the following functionality should be implemented for the close() method: 1. Display "Do you really want to close the stream? Y/N". 2. Read a line. 3. If the read line
10
Task
Java Core, level 8, lesson 8
Locked
AmigoOutputStream
1 Change the AmigoOutputStream class so that it wraps the FileOutputStream class. Use inheritance. 2 When the close() method is called, perform the following sequence of actions: 2.1 Call the flush() method. 2.2 Append the following text "CodeGym © All rights reserved." Use the getBytes() method. 2.
10
Task
Java Core, level 8, lesson 8
Locked
UnsupportedFileName
Change the TxtInputStream class so that it only works with txt files (* .txt). For example, first.txt or name.1.part3.txt. If a non-txt file is passed (e.g. file.txt.exe), then the constructor should throw an UnsupportedFileNameException. Think about what else you need to do if an exception is throw
10
Task
Java Core, level 8, lesson 8
Locked
Table
Change the TableInterfaceWrapper class so that it wraps TableInterface. The setModel method should display the number of elements in the new list before updating the model. The getHeaderText method should return the text in upper case. Use the toUpperCase() method.
Comments (23)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Jcode Level 27, United Kingdom
28 December 2022
task1813 2.3 Close the stream using the close() method Requirements: Don't change the main method. MyComment: Really? How do we close the stream without running the close method we have created?
Evgeniia Shabaeva Level 37, Budapest, Hungary
16 August 2024
I know this is late, but for "future generations" I'll write that in this task we should close it inside the close method we're overriding.
whoseunassailable Level 28, India, India
20 April 2022
As of now,i feel like i really struggle with the topic of constructors and getters and setters even though i understand it. It's like i understand it but i can't feel it in order to execute properly. I feel though in the near future i will be able to come out of it with practice and develop it in such a way that my mind will solve questions like this unknowingly. If there's a book or topic if one can suggest then please go ahead and do so. I will start reading all the books once i am done with the course which might take another month or so so (I decided to complete the course in two weeks which is not possible considering my college, gym, diet and personal life i hope i will be with it in a month and half ;).
Jurij Thmsn Level 29, Flensburg, Germany
9 April 2021
check out these links for further information about decorator patterns: general: https://refactoring.guru/design-patterns/decorator java: https://refactoring.guru/design-patterns/decorator/java/example
Nyerges Ferenc Level 31, Bükkábrány, Hungary
11 June 2020
Small note - in the strings, after "body" it worth adding a space too... was hard to figure out, maybe helps to someone.
Manish Sinha Level 26, london, United Kingdom
28 April 2020
these tasks really helps to understand the topic in better and practical way.
Attila Level 25
20 April 2020
If you struggle understanding this subject, here is a great example with explanation: https://www.geeksforgeeks.org/decorator-pattern/ https://www.geeksforgeeks.org/the-decorator-pattern-set-2-introduction-and-design/?ref=rp https://www.geeksforgeeks.org/decorator-pattern-set-3-coding-the-design/?ref=rp Hints: #3 super (fileName); #4 Java String endsWith() method #5 tableInterface.setModel(rows);
MaGaby2280 Level 41, Guatemala City, Guatemala
20 February 2020
Hard tasks... and sometimes it all comes down to a point or a space ;o) Hard earned dark matters... 1020
- FniJnn - Level 33, Paris, France
1 December 2019
That's toughhhh
Robert Constantinescu Level 25, Bucharest, Romania
1 December 2019
I believe these tasks really need a review for the conditions unless the conditions are intended to have mistakes.
Fadi Alsaidi Level 34, Carrollton, TX, USA
11 March 2020
I completely agree. None of the task where that difficult. The difficulty was understanding what those conditions meant.
Agent Smith Level 38
4 September 2020
Hmm, tbh I had no problems with understanding tasks conditions so far. Yet, sometimes they do feel designed in a way that you have to think a bit about what you really have to do. But in my experience it adds to the learning process.
Piotr Wikarski Level 19, Birmingham, United Kingdom
2 November 2019
Another great tasks for my java muscles in my brain ! 💪💪💪