print vs println

Lab Java Beginner 10 points

Using System.out.print for the first two words and println for the last, print Java is fun on one line, then Done on the next line.

Input

None.

Output

Two lines.

Example

Output

Java is fun
Done
Sample output available
Editor
Java

Hints

print does not add a new line; println does.

Solution explanation

print leaves the cursor on the same line, so the next output continues there.

Show solution
public class Main {
    public static void main(String[] args) {
        System.out.print("Java ");
        System.out.print("is ");
        System.out.println("fun");
        System.out.println("Done");
    }
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD