What is the system.out . Println() for tgis method ?? Please tell me | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

What is the system.out . Println() for tgis method ?? Please tell me

static void sayHello(String name , String sex, int age)

3rd May 2017, 7:17 AM
Digdarshan Ameta
Digdarshan Ameta - avatar
2 Respostas
+ 9
If you mean you want to print out the name, sex and age you can use + " " + to create a space or put text in between them. Example: public static void sayHello(String name, String sex, int age) { System.out.println("Hello " + name + ", you are a " + sex + " and you are " + age + " years old."); }
3rd May 2017, 9:11 AM
ChessMaster
ChessMaster - avatar
0
no I mean for the following program class MyClass { static void sayHello(String name) { System.out.println("Hello " + name); } public static void main(String[ ] args) { sayHello("David"); sayHello("Amy"); } } here if i want to declare property of the sayHello method name , age , gender then what will be the full code
3rd May 2017, 10:26 AM
Digdarshan Ameta
Digdarshan Ameta - avatar