- 1

Why my code doesnt work?

class MyClass { static int sum(String val1, String val2) { System.out.println("val1+val2"); } public static void main(String[ ] args) { sum (flying,dagger); } }

8th Dec 2017, 12:30 AM
Jerald Loh
4 Respuestas
+ 6
Next time please use the Code Playground and post a link to it instead of writing the code out.
8th Dec 2017, 5:51 AM
Learnsolo
+ 5
Sololearn has code playground for a reason. It can run basic codes. Perhaps you can post questions asking here "Why does my code not work" if it doesn't work
8th Dec 2017, 1:38 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
You need at least declare flying,dagger vars before passing them as parameters.
8th Dec 2017, 12:35 AM
Dima Makieiev
Dima Makieiev - avatar
+ 1
@dima class MyClass { static void sayHello(String name) { System.out.println("Hello " + name); } public static void main(String[ ] args) { sayHello("David"); sayHello("Amy"); } } david and amy isnt declared
8th Dec 2017, 12:36 AM
Jerald Loh