After extending FileOutputStream, it won't let me create a constructor that accepts a FileOutputStream object.
Stuck at the beginning
Resolved
Comments (6)
- Popular
- New
- Old
You must be signed in to leave a comment
Guadalupe Gagnon
19 February 2019, 19:42
If you click on the code that is red and hit alt+enter it will give you some ideas to fix your code. My thought is you probably are not calling the super() constructor.
0
Andrew
19 February 2019, 19:57
That kind of helps but I still can't figure out how to resolve the call to super(). Here's what I have:
private FileOutputStream outputStream;
public AmigoOutputStream(FileOutputStream outputStream) {
super(???);
}
I know the super() constructor wants a String but I can't figure out how to get it the String passed to the FileOutputStream object.
+1
Guadalupe Gagnon
19 February 2019, 20:07useful
it wants a file name, there should be a static string with just that.
super(fileName);
then set the passed in FOS to the class property.
+3
Guadalupe Gagnon
19 February 2019, 20:09
These particular tasks, with the 'wrappers', were some of the most confusing for me. I spent nearly as much time doing these tasks as I did doing levels 1-10. I almost quit over task 1815 (look for my post under the help section for that task, it gives a good hint to solve).
0
Andrew
19 February 2019, 20:15solution
Oh duh, the fileName is static! Thanks!
+3
zhaoyang
30 June 2019, 17:24
why we need the super constructor when write wrapper class since the input parameter is already a FileOutputStream object
+2