Can we change david and ami in the program to numericals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can we change david and ami in the program to numericals

class MyClass { static void sayHello(String name) { System.out.println("Hello " + name); } public static void main(String[ ] args) { sayHello("David"); sayHello("Amy"); }

12th Feb 2018, 4:48 AM
raghu kittu
raghu kittu - avatar
3 Answers
+ 2
you can only send string types to your function sayHello
12th Feb 2018, 5:00 AM
Pavan Kumar T S
Pavan Kumar T S - avatar
0
Change "static void sayHello(String name)" with "static void sayHello(int numerical)" (or float or double instead of int)
12th Feb 2018, 5:08 AM
Leonardo Medai Cossutta
Leonardo Medai Cossutta - avatar
0
in that case @ Leonardo .do we get the output as the sum of the numbers placed side by sibe
18th Feb 2018, 6:12 PM
raghu kittu
raghu kittu - avatar