Computer Science, asked by kraghaver, 1 year ago

What is the output of the following code?

System.out.print(“Hello ”); System.out.println(“World ”); System.out.print(“Java is fun!”);

Hello World Java is fun!

Hello World Java is fun!

Hello World Java is fun!

Hello World Java is fun!

Answers

Answered by Madhu123mri
3
Answer:

Hello World
Java is fun!

Hope it helps! :)
Answered by BrainlyYoda
2

The output of the following códe will be

Hello World

Java is fun!

Explanation

In Java, there are two print methods that are used to display the output of códe in the console.

System.out.print();

After this print statement is executed it will print the output according to what is there in between the brackets and will keep the cursor at the end of the output in the console and if there is any other print statement to be executed it will give output in continuation to first output.

System.out.println();

After this print statement is executed it will print the output according to what is there in between the brackets and will shift the cursor to the new line in the console and if there is any other print statement to be executed it will give output in new line.

Example

System.out.print("Hello ");

System.out.print("World");

Output

Hello World

In this cursor will be present after World

System.out.println("Hello ");

System.out.println("World");

Output

Hello

World

In this cursor will be present after World in new line.

Similar questions