Hey Im having trouble understanding these error codes. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hey Im having trouble understanding these error codes.

So, I'm kind of new to Java and I have task myself with making a set of code that would give you the numbers involved with equipping and unequipping armor. However when I was I ran my code to find errors I had these three that I don't know how to resolve. If you don't mind helping I would appreciate assistance understanding them. https://code.sololearn.com/c3a7JVuME3Se/?ref=app

5th Dec 2018, 8:37 PM
OSBIRTAMI
OSBIRTAMI - avatar
11 Answers
+ 11
We will debug your code step by step... 🔹First, compiler shows some error in this line: int add_armorClass(armorRating); In your code, this is line 25. I guess you wanted to call the method add_armorClass(), but you have confused the compiler with "int" because compiler expects the variable type int instead your invitation to the method. So, fix line 25 - delete "int" : add_armorClass(armorRating); Now, hit run. 🔹You will notice that compiler shows two different errors. First error: missing method body or declare abstract public void equip(); In your code, this is line 21. As you can see, this is typing error - delete semicolon between () and { public void equip() { Second error: cannot find simbol add_armorClass(armorRating) in class Cuirass. The method you invoked from the Cuirass is in the Player class. You've extended Cuirass with the Armor class. So, there is no path to the Player class and method. add_armorClass(). Try extends class Armor with class Player (in line 12) Hit run again
5th Dec 2018, 10:16 PM
LukArToDo
LukArToDo - avatar
+ 10
Danijel Ivanović Don't worry my friend, I am always close 👻...and I'm watching you 👀 😅 Btw, congrats for mod status 😊👏👏👏👍👌🎉🎆 OSBIRTAMI Keep coding...you're good 👍
5th Dec 2018, 11:13 PM
LukArToDo
LukArToDo - avatar
+ 9
(continue) ...There is no error ("time limit exceeded" is because you haven't main method in your code).
5th Dec 2018, 10:17 PM
LukArToDo
LukArToDo - avatar
+ 7
I do not know about your way of working and I'm not familiar with this way of debugging on SL Code playground, (I don't know is it possible here). I really do not know how to help you, but I guess someone sure will!👍
5th Dec 2018, 8:59 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 5
💪LukArToDo 😄🤘🍻🤓 Ti razbijaš na svim frontovima...! 👍 👀 samo vrebaš 😃😁😀👏👏😉
5th Dec 2018, 11:02 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 5
LukArToDo 😁💪😄✌ Thanks a lot @Mila, 🤗 I know you're always beside me! 👀💪🍻😉👍😊
5th Dec 2018, 11:26 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 4
How do you think your code works without the main() method !?
5th Dec 2018, 8:46 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 3
Thanks guys you were a great help!!
5th Dec 2018, 10:47 PM
OSBIRTAMI
OSBIRTAMI - avatar
+ 3
Thanks!
5th Dec 2018, 11:22 PM
OSBIRTAMI
OSBIRTAMI - avatar
+ 1
Ok thanks any way!
5th Dec 2018, 9:03 PM
OSBIRTAMI
OSBIRTAMI - avatar
0
I was going to add that after I wrote the other code and made sure it was error-free
5th Dec 2018, 8:48 PM
OSBIRTAMI
OSBIRTAMI - avatar