- 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); } }
4 Answers
+ 6
Next time please use the Code Playground and post a link to it instead of writing the code out.
+ 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
+ 4
You need at least declare flying,dagger vars before passing them as parameters.
+ 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