Task 5 of 11 · 0 solved · 11 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

1.1 Output — quotes and exact text

Lesson

Quotes and exact text

Quotes mark where text begins and ends — the quotes themselves are not printed. Everything inside is printed exactly: every letter, space, and symbol.


Worked example

System.out.println("Hello");   // Hello
System.out.println("2 + 3");   // 2 + 3  (text, not 5)
System.out.println("a   b");   // a   b  (spaces kept)

Java does not compute what is inside the quotes — "2 + 3" prints as text.


▶ Try it: run this, then change something and run it again.



What does System.out.println("Hello"); print?


What does System.out.println("2 + 3"); print?


Type exactly what this prints:

System.out.println("Java is fun");

Which line prints exactly cat dog (with a space)?


Type exactly what this prints:

System.out.println("Hi!");