Ask Question
7 April, 03:47

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

+4
Answers (2)
  1. 7 April, 04:19
    0
    Hello bob
  2. 7 April, 05:19
    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
Know the Answer?
Not Sure About the Answer?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers