1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
andriy [413]
3 years ago
5

Write a program that prompts the user for a name (any String value would work for testing), and print a hello message to the con

sole with the input string after hello. (if the user typed 'class' then the console will display 'Hello class').
Computers and Technology
1 answer:
Slav-nsk [51]3 years ago
4 0

Answer:

// program in Java.

// package

import java.util.*;

// class definition

class Main

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input

Scanner scr=new Scanner(System.in);

 // ask to enter the name

System.out.print("Enter a name:");

 // read name

String name=scr.nextLine();

 // print the hello message

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

   }catch(Exception ex){

       return;}

}

}

Explanation:

Create a Scanner object to read name from user.Read name from user and assign it to variable "name".Then print the message Hello followed by the name.

Output:

Enter a name:Sam

Hello Sam

You might be interested in
Can you call a mobile a computer. It Yes<br>why? If No why​
Lera25 [3.4K]

Answer:

Yes

Explanation:

You can call mobile a computer because it come under one of the categories of the computer.

That category being microcomputers.

6 0
4 years ago
Read 2 more answers
Czy FALL GUYS będzie działało szybko na i5 GH8? Na ilu FPS?
Lesechka [4]

Answer:español por favor asi te responderé y gracias por los 10 puntos chaoo

Explanation:

6 0
3 years ago
Which tab is used to insert a hyperlink onto a slide?
babunello [35]

the answer is C. Insert

3 0
3 years ago
What term identifies the physical interface between a computer and its peripherals?
antoniya [11.8K]
(B. Hardware), Hardware is physical components, Software are the programs in the computer.
3 0
3 years ago
NEED HELP ASAP! BRAINLIEST AND 20 PTS TO CORRECT ANSWER!
son4ous [18]

The correct answer is C.

8 0
3 years ago
Other questions:
  • ANSWER ME PLS
    9·1 answer
  • Which of the following code segments does not contain any errors?
    7·1 answer
  • Grace is performing a penetration test against a client's network and would like to use a tool to assist in automatically execut
    13·2 answers
  • You are developing a system to process lists of days of the week, represented as strings. Create a function is_weekend that cons
    12·1 answer
  • Any material that comes into contact with the body must be __________.
    6·1 answer
  • What creative commons license allow for the work to be copied, distributed, displayed, or performed but modifications may not be
    13·1 answer
  • A<br>A<br>printount<br>of your report or a till slip is an<br>example of what​
    15·1 answer
  • Why When I change my pfp It be blurry and it be ugly- if you know what I mean :c
    15·2 answers
  • Calculate the time complexity for the following function in terms of Big O notation. Explain your answer.
    13·1 answer
  • Twisted copper telephone wire, coaxial copper cable, fiber-optic cable, and media for wireless transmission are all __________.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!