what is wrong in the codes. i would appreciate any help. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is wrong in the codes. i would appreciate any help.

public class Program { public static void main(String[] args) { int res = test(45); System.out.print(res); } static void test(int x) { return int x+98; } }

6th Feb 2017, 12:54 PM
shobhit
shobhit - avatar
1 Answer
+ 1
Shobbit, You have mistyped the return type of your test method it must be "int" instead of "void". and just write return x+98;
6th Feb 2017, 1:02 PM
GeekyShacklebolt
GeekyShacklebolt - avatar