Another way

Report a typo

Practice is the best way to consolidate knowledge. Create a text block containing the following lines:

I have a friend
Whose name is...
And we have fun together.
We laugh and play
And sing all day
In any kind of weather.

Display the result on the screen. Make sure there are no empty lines in the output.

Sample Input 1:

Sample Output 1:

I have a friend
Whose name is...
And we have fun together.
We laugh and play
And sing all day
In any kind of weather.
Write a program in Java 17
class Main {
public static void main(String[] args) {
String textBlock = //write your code here
}
}
___

Create a free account to access the full topic