Ask Question
13 September, 00:13

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

+3
Answers (2)
  1. 13 September, 03:02
    0
    Hello bob
  2. 13 September, 03:04
    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?
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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers