Write some code that reads a value representing a name into the variable 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 "Hassan" it would print out "Greetings, Hassan!!!" on a line by itself.

Respuesta :

ijeggs

Answer:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

Scanner input = new Scanner(System.in);

       System.out.print("Please Enter Your name: ");

       String name = input.nextLine();

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

   }

}

Explanation:

In java programming language;

  1. Import and make an object of the Scanner class. This will allow you receive user input
  2. Prompt User to enter a name
  3. receive and store the name in a variable
  4. Using String concatenation (This is achieved with the + operator) output the Greetings as required by the question