How can I resolve this error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
25th Apr 2023, 9:47 PM
Secret Look
Secret Look - avatar
8 Answers
29th Apr 2023, 12:17 PM
Pradip Singh
Pradip Singh - avatar
+ 2
You must return something in the end of your method and outside of for loop. For example return a zero value (return 0)
25th Apr 2023, 10:54 PM
Black Winter
+ 2
I fixed you code you can see below 👇 https://code.sololearn.com/cTm0ZnV9075D/?ref=app
27th Apr 2023, 11:06 AM
Pradip Singh
Pradip Singh - avatar
+ 1
1. Just change the return type to void and remove return statement 2. replace int animalAge = cows[x][y] with System.out.println(cows[x][y]) 3. and just call the animal function in main method and you can also see the code 👇 😄 https://code.sololearn.com/cTm0ZnV9075D/?ref=app
29th Apr 2023, 2:50 AM
Pradip Singh
Pradip Singh - avatar
0
Ok, but how can I print all the elements of 2d array?
28th Apr 2023, 5:34 PM
Secret Look
Secret Look - avatar
0
I already did this, but I want to make a returned 2d array.
29th Apr 2023, 7:22 AM
Secret Look
Secret Look - avatar
0
Thx
4th May 2023, 9:42 AM
Secret Look
Secret Look - avatar
0
Welcome Bro
5th May 2023, 2:46 AM
Pradip Singh
Pradip Singh - avatar