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
Effectus [21]
2 years ago
15

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

the console with the input string after hello. (if the user typed 'class' then the console will display 'Hello class').
Computers and Technology
1 answer:
BabaBlast [244]2 years ago
7 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 "y_name".Then print the message Hello followed by the name.

Output:

Enter your name:Krish                                                                                                      

Hello Krish

You might be interested in
AUPs ensure that an organization’s network and internet are not abused. Select 3 options that describe AUPs.
tigry1 [53]

AUPs often involves not going onto unauthorized sites or downloading certain content, not using the service to violate any law, and not connecting to unauthorized devices through the network.

<h3>What is AUP?</h3>

AUP stands for Acceptable Use Policy, which refers to a policy that regulates users when they access a corporate newtork.

<h3>How does an AUP regulates users?</h3>

Most AUPs imply:

  • Users can only access certain sites and dowloading specific content is forbidden.
  • The access to the internet or network cannot be used for criminal purposes.
  • Only authorized users can connect to the corporate network.

Learn more about AUP in: brainly.com/question/9509517

#SPJ1

8 0
1 year ago
What type of thinking work does the computer need to do to solve the problem?
poizon [28]

Answer:

<h3>Computational Thinking is the thought processes involved in formulating a problem and expressing its solution in a way that a computer—human or machine—can effectively carry out.</h3>

Pa brainliest po

3 0
2 years ago
Two character strings may have many common substrings. Substrings are required to be contiguous in the original string. For exam
ryzh [129]

Answer:

Explanation:

The following function is written in Java. It takes two strings as parameters and calculates the longest substring between both of them and returns that substring length.

import java.util.*;

class Test

{

   public static void main(String[] args)

   {

       String X = "photograph";

       String Y = "tomography";

       System.out.println(X + '\n' + Y);

       System.out.println("Longest common substring length: " + longestSub(X, Y));

   }

   static int longestSub(String X, String Y)

   {

       char[] word1 = X.toCharArray();

       char[] word2 = Y.toCharArray();

       

       int length1 = X.length();

       int length2 = Y.length();

       int substringArray[][] = new int[length1 + 1][length2 + 1];

       int longestSubstringLength = 0;

       

       for (int i = 0; i <= length1; i++)

       {

           for (int j = 0; j <= length2; j++)

           {

               if (i == 0 || j == 0)

                   substringArray[i][j] = 0;

               else if (word1[i - 1] == word2[j - 1])

               {

                   substringArray[i][j]

                           = substringArray[i - 1][j - 1] + 1;

                   longestSubstringLength = Integer.max(longestSubstringLength,

                           substringArray[i][j]);

               }

               else

                   substringArray[i][j] = 0;

           }

       }

       return longestSubstringLength;

   }

}

8 0
2 years ago
The variables within the class all are related to help describe the object.
lawyer [7]
This does not make sense
3 0
3 years ago
Should you let your computer scan email attachments before opening them? Why?
NISA [10]
Jjsjskskiakskskakksjakakoa
8 0
2 years ago
Read 2 more answers
Other questions:
  • What is a benifit of having a client/server network?
    6·1 answer
  • All of the nested folders you created will carry the same permissions as the __________ until you make changes.
    10·1 answer
  • Which term describes the situation wherein a jury fails to reach a unanimous verdict? A occurs when a jury cannot reach a unanim
    14·1 answer
  • Artificial intelligence seeks ways to improve a computer's capabilities in ____ and reasoning tasks. intellectual computational
    13·1 answer
  • Discuss the benefits of a system safety effort other than improved safety
    8·1 answer
  • What are at least three tips to taking photographs of insects? Why would following the tips help create better photographs?
    10·1 answer
  • How does a computer work
    13·1 answer
  • Someone gave me flashcards on a keychan. I have to memorize them and then give them back. Can I back them up to my PC by creatin
    5·1 answer
  • To be useful for most household applications, DC voltage is?please <br>​
    7·1 answer
  • What is file management?can please help me​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!