14.8k views
2 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 message and the value of word should appear together, on a single line on standard output.

1 Answer

1 vote

Answer:

// variables declaration and initialization

String word="Monday";

// print statement

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

Step-by-step explanation:

Declare and initialize a String variable "Word" with "Monday". Then print a message "Today's Word-Of-The-Day is:" followed by the value of "Word" with the help of "+" operator.This will print the whole message in a single line.

//Here is implementation 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{

// variables

String word="Monday";

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

}catch(Exception ex){

return;}

}}

Output:

Today's Word-Of-The-Day is:Monday

User Mkadan
by
5.6k points