Skip to content
AS & A Level 9618 · Paper 4 · Java

Java Path

Paper 4 accepts Python, Java or VB.NET. This path teaches it in Java, one small program at a time: each step is compiled by the real javac in your browser and checked against tests, some hidden. Read each value with Scanner's nextLine() — one value per line — and print exactly what is asked. Also in VB.NET and Python; try anything freely in the Java Playground.

Your progress

0 of 47 steps done

47 steps in 10 blocks. Progress follows your account when you are signed in.

Start at Step 1
  1. A

    Block A · Data, input and output

    Read values a line at a time, convert them to the right type and print exactly what is asked. Steps 1–5 of 47 · 9618 §11.1

    0 / 5 done

    1. 1Hello, name
    2. 2INTEGER and REAL
    3. 3DIV and MOD
    4. 4STR_TO_NUM and LENGTH
    5. 5Seconds to hours, minutes, seconds
  2. B

    Block B · Selection

    IF with ELSE IF chains, nested conditions and CASE — switch in Java, Select Case in VB.NET. Steps 6–10 of 47 · 9618 §11.2

    0 / 5 done

    1. 6Temperature bands
    2. 7Mark to grade
    3. 8Leap year
    4. 9CASE OF a role code
    5. 10Largest of three
  3. C

    Block C · Iteration

    Count-controlled, pre-condition and post-condition loops, totals, averages and loops inside loops. Steps 11–16 of 47 · 9618 §11.2

    0 / 6 done

    1. 11Sum of squares
    2. 12Countdown
    3. 13Largest until zero
    4. 14REPEAT … UNTIL in range
    5. 15Average of n marks
    6. 16A multiplication grid
  4. D

    Block D · Strings

    LEFT, RIGHT, MID, LENGTH, UCASE, LCASE and characters — the string work Paper 4 asks for. Steps 17–22 of 47 · 9618 §11.1 · guide §5

    0 / 6 done

    1. 17LEFT, RIGHT and MID
    2. 18Count the vowels
    3. 19Reverse a string
    4. 20Palindrome check
    5. 21Caesar shift
    6. 22Count the words
  5. E

    Block E · Procedures and functions

    Write your own procedures and functions with parameters and return values, and call them from the main program. Steps 23–27 of 47 · 9618 §11.3

    0 / 5 done

    1. 23A procedure to draw a line
    2. 24A function that returns the larger
    3. 25IsPrime
    4. 26Factorial with a loop
    5. 27Swap two values
  6. F

    Block F · Arrays

    1D and 2D arrays: fill them from input, total them, search them, count with them. Steps 28–32 of 47 · 9618 §10.2 · §11.1

    0 / 5 done

    1. 28Total and largest
    2. 29Print in reverse
    3. 30Count a value
    4. 31Row totals of a 2D array
    5. 32Dice frequencies
  7. G

    Block G · Searching and sorting

    Linear search, bubble sort, insertion sort and binary search — written out by hand, the way Paper 4 asks. Steps 33–36 of 47 · 9618 §10.2 · §19.1

    0 / 4 done

    1. 33Linear search
    2. 34Bubble sort
    3. 35Insertion sort, descending
    4. 36Binary search
  8. H

    Block H · Records and object-oriented programming

    Records, classes with private attributes, constructors and methods, inheritance and polymorphism. Steps 37–40 of 47 · 9618 §10.1 · §20.1

    0 / 4 done

    1. 37The top student
    2. 38A Rectangle class
    3. 39A bank account
    4. 40Inheritance and polymorphism
  9. I

    Block I · Recursion and exceptions

    Functions that call themselves, and programs that catch a run-time error instead of crashing. Steps 41–44 of 47 · 9618 §19.2 · §20.2

    0 / 4 done

    1. 41Recursive factorial
    2. 42Recursive Fibonacci
    3. 43Catch a bad number
    4. 44Safe division
  10. J

    Block J · Stacks, queues and linked lists

    The abstract data types Paper 4 builds from arrays and pointers. Steps 45–47 of 47 · 9618 §19.1

    0 / 3 done

    1. 45A stack in an array
    2. 46A circular queue
    3. 47An ordered linked list
Enroll nowOnline classes