0
What is the system.out . Println() for tgis method ?? Please tell me
static void sayHello(String name , String sex, int age)
2 Réponses
+ 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.");
}
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