Ask Question
8 October, 04:59

Assume that name has been declared suitably for storing names (like "Misha", "Emily" and "Sofia"). Assume also that stdin is a variable that references a Scanner object associated with standard input. Write some code that reads a value into name then prints the message "Greetings, NAME" on a line by itself, where NAME is replaced the value that was read into name. For example, if your code read in "Rachel" it would print out "Greetings, Rachel" on a line by itself.

+2
Answers (1)
  1. 8 October, 08:24
    0
    String name = stdin. nextLine ();

    System. out. println ("Greetings "+name);

    Explanation:

    See a complete java program below

    import java. util. Scanner;

    public class num7 {

    public static void main (String[] args) {

    Scanner stdin = new Scanner (System. in);

    System. out. println ("Enter a name");

    String name = stdin. nextLine ();

    System. out. println ("Greetings "+name);

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Assume that name has been declared suitably for storing names (like "Misha", "Emily" and "Sofia"). Assume also that stdin is a variable ...” 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