GCGrowCarrer

Console Input and Output

Locked

Lesson 4 of 60 · Syntax · Easy

StringsNext: Conditionals

Finish these first:Variables and Primitive Types →Or pass the tests below to unlock it now.

1

The big idea

To display text on screen in Java, programs build a String message and print it with System.out.println(...): You can join pieces of text together with +, and every Java statement ends with a semicolon ;.

Think of it like this: Think of console output like a receipt printer: first you build the text message in a `String`, then `System.out.println(...)` prints it.
Key words (tap to learn):
2

Read the lesson

To display text on screen in Java, programs build a String message and print it with System.out.println(...):

String name = "Maya";
String note = "Welcome, " + name;
System.out.println(note);

You can join pieces of text together with +, and every Java statement ends with a semicolon ;.

3

Quick check

How do you print a line of text to the console in Java?

4

Your challenge

1 sample test, 1 hidden

Inside Solution, create a String variable named message set to "Hello, Ada" (type String message = "Hello, Ada";).

Stuck? Get a hint (free)
More learning tools(compare languages, visual guide, related lessons)

Compare with another language

Similar to python.input-output (85% overlap). `input()/print()` vs `Scanner`/`System.out`.

Visual walkthrough

A diagram, a step-by-step animation, and short captions for Console Input and Output.

Mastery0%

Learn this first

Opens up next

This is the last lesson in this branch.