Ask Question

Given a string name, e. g. "Bob", return a greeting of the form "Hello Bob!". helloName ("Bob") → "Hello Bob!" helloName ("Alice") → "Hello Alice!" helloName ("X") → "Hello X

+2
Answers (2)
  1. 10 August, 20:29
    0
    public class num1 {

    public static String helloName (String name) {

    return "Hello "+name+"!";

    }

    public static void main (String[] args) {

    System. out. println (helloName ("Alice"));

    }

    }

    Explanation:

    Java programming language has been used for this task.

    Start by defining a method that returns a String the method's name is helloName (name); Which receives a String parameter

    In the method's body return the String name which is passed as an argument with the the word "Hello" concatenated.

    Call The method in the main method passing any name as an argument
  2. 10 August, 20:38
    0
    Hello bob
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Given a string name, e. g. "Bob", return a greeting of the form "Hello Bob!". helloName ("Bob") → "Hello Bob!" helloName ("Alice") → "Hello ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers