levo

Exception Handling and Managing Input and Output

Controlling screen output

  • 3 things to know
  • AS Unit 1

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.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

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

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A null is the of one.
absencepresencetype

Blank Blitz makes facts automatic

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

AA null means no value has been recorded.
BZero and an empty string are values.
CA null is the absence of a value.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

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.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

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