Ask Question
7 April, 16:37

Write an expression whose value is the concatenation of the three str values associated with name1, name2, and name3, separated by commas. So if name1, name2, and name3, were (respectively) "Neville", "Dean", and "Seamus", your expression's value would be "Neville, Dean, Seamus".

name1 + "," + name2 + "," + name3

+4
Answers (1)
  1. 7 April, 19:08
    0
    Correct Question:

    Write an expression whose value is the concatenation of the three str values associated with name1, name2, and name3, separated by commas. So if name1, name2, and name3, were (respectively) "Neville", "Dean", and "Seamus", your expression's value would be "Neville, Dean, Seamus".

    Answer:

    name1 + "," + name2 + "," + name3

    Explanation:

    This is called string concatenation. Using Java programming language, see below an interactive program making use of this expression to request for three names and output them as required by the question.

    import java. util. Scanner;

    public class ANot {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter the first name");

    String name1 = in. next ();

    System. out. println ("Enter the second name");

    String name2 = in. next ();

    System. out. println ("Enter the third name");

    String name3 = in. next ();

    //concatenating and printing out the names.

    System. out. println (name1 + "," + name2 + "," + name3);

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write an expression whose value is the concatenation of the three str values associated with name1, name2, and name3, separated by commas. ...” 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