Ask Question
28 October, 13:11

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. 28 October, 15:34
    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?
Get 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 & 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