Complete the second printSalutation() method to print the following given personName "Holly" and customSalutation "Welcome":

Welcome, Holly
FOR JAVA PLEASE
import java.util.Scanner;

public class MultipleSalutations {
public static void printSalutation(String personName) {
System.out.println("Hello, " + personName);
return;
}

//Define void printSalutation(String personName, String customSalutation)...

/* Your solution goes here */

public static void main (String [] args) {
printSalutation("Holly", "Welcome");
printSalutation("Sanjiv");

return;
}
}

Respuesta :

Answer:

The explanation of this code is give below in explanation section.

Explanation:

public class MultipleSalutations {

public static void printSalutation(String personName) {

System.out.println("Hello, " + personName);

return;

}

public static void printSalutation(String personName, String customSalutation) /* this method will take two string parameter and print custom salutation*/

{

   System.out.println(customSalutation+ " "+personName);//print custom salutation

}

public static void main (String [] args) {

printSalutation("Holly", "Welcome");

printSalutation("Sanjiv");

return;

}

}

Ver imagen asarwar

Answer:

public static void printSalutation ( String personName, String customSalutation ){

     System.out.println( customSalutation + ", " + personName );

     }

Explanation:

Ver imagen DarthVaderBarbie