levo

Exception Handling and Managing Input and Output

Controlling screen output

  • 3 things to know
  • AS Unit 1
Start revising · £5/month

Overview

Standard output stream and difference between print and println.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

A program runs System.out.print("Total: "); System.out.println(12 + 8);. What appears on the screen?

Key term

What is the standard output stream?

Key term

State the difference between print and println.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is the standard output stream?

    Model answer

    The standard output stream is the default destination for a program's text, normally the console window, so the program writes without needing to know where the text will appear.

  2. 2

    State the difference between print and println.

    Model answer

    The print method writes its text and leaves the cursor at the end of the same line, while println writes its text and then moves to the start of the next line.

  3. 3

    A program runs System.out.print("Total: "); System.out.println(12 + 8);. What appears on the screen?

    Model answer

    The first call does not end the line, and the addition is worked out before printing, so the screen shows Total: 20 on a single line.

  4. 4

    What does the escape sequence written as a backslash followed by n do inside a string?

    Model answer

    The two characters are not printed; the output moves to the start of a new line at that point in the text.

  5. 5

    What does the escape sequence written as a backslash followed by t do?

    Model answer

    The output jumps forward to the next tab position, so values printed after it line up in columns.

  6. 6

    How is a double quote included in a string that is itself delimited by double quotes?

    Model answer

    A backslash is written in front of the quote, so the compiler treats the quote as a character of the text rather than as the end of the string.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A null is the of one.
absencepresencetype

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Exception Handling and Managing Input and Output, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.