12.4k views
3 votes
Assume that word is a String variable. Write a statement to display the message "Today's Word-Of-The-Day is: " followed by the value of word. The entire message, including the value of word, should appear on a single line of output. For example, if the value of word is "Hello", the statement should display the following: Today's Word-Of-The-Day is: Hello Hint: In your code make sure the string literal "Today's Word-Of-The-Day is: " is written exactly as shown here.

1 Answer

3 votes

Answer:

import java.util.Scanner;

public class TestClock {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.println("Enter a word for the day");

String word = in.next();

System.out.println("Today's Word-Of-The-Day is: "+word);

}

}

Step-by-step explanation:

Use Scanner class to receive a user's value for the 'word' or

Create a variable and save user's input

Use string concatenation (plus operator) in the System.out.println To display the output as required by the question.

User Jboxxx
by
7.7k points

No related questions found