#Adding to a function
27 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @crisp rivet! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
ask, debug, example, format, js, try, resources, adopt, codelength, null-pointer, restart, homework, comparing-strings, index-out-of-bounds, comparison-assignment-operators, rule11, xyproblem, static, nohello, jre_jdk, learn, help, scanner, pseudocode, class-versions
nvm we dont have an image of code tag
Apologies I should have tagged it
not that kind of tag
```java
code here
```
anyways @crisp rivet can you post the code you already have here
or at least give us a clearer screenshot of it
Yeah sure lemme try here
So I can only edit between lines 32 and 35, I can add more lines in there but I cannot touch outside of that range. In photo 1 you can see what I've written, in photo 2 you can see the base printAll() and see the class PetData extends AnimalData (PetData is where my written printAll() is) and in the 3rd photo you'll see where the method printAll() is being called.
This is through zybook and its like an interactive textbook for learning java
are you aware of the super keyword
it's basically the instance of the class above you, hierarchy wise
eg super.printAll() will invoke the parent's printAll() method
you can just invoke that from the PetData printAll method, then print the next data segment out
Yes, I was unaware I could do that in this method. We have only used it at the start of our classes
public void printAll() {
super.printAll(); // prints Name: xxx, Age: yyy and does not end the line
System.out.print(", ID: "+idNum); // prints , ID: zzz, resulting in "Name: xxx, Age: yyy, ID: zzz"
}
I see thank you
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
I didn't realize you could do that