125k views
0 votes
Write a complete java program that will display the word CS and the number 140, each on its own line.

User Jacksonsox
by
8.4k points

1 Answer

1 vote
The code will contain only the main class.
Note that to print two lines using only one command, we will use "\\" command.

The code will be as follows:
public class PrintSeparateLines {
public static void main (String[]args)
{
System.out.println("CS" + "\\" + "140");
}
}

The output of this code will be:
CS
140
User Nicolas Payette
by
8.7k points

No related questions found