+ 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
11 odpowiedzi
+ 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
+ 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 👍
+ 9
(continue)
...There is no error ("time limit exceeded" is because you haven't main method in your code).
+ 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!👍
+ 5
💪LukArToDo 😄🤘🍻🤓
Ti razbijaš na svim frontovima...! 👍
👀 samo vrebaš 😃😁😀👏👏😉
+ 5
LukArToDo 😁💪😄✌
Thanks a lot @Mila, 🤗
I know you're always beside me! 👀💪🍻😉👍😊
+ 4
How do you think your code works without the main() method !?
+ 3
Thanks guys you were a great help!!
+ 3
Thanks!
+ 1
Ok thanks any way!
0
I was going to add that after I wrote the other code and made sure it was error-free