Ask 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".

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

+3
Answers (1)
  1. 2 September, 09:22
    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 & 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