The AP Java Subset: Language Features Topic Index

  1. The control structures if, if/else, while, for, return are part of the AP Java subset.
    ( The do/while, switch, plain and labeled break and continue statements are not in the subset.)
  2.  /* */, and // comments. (only these)
  3. The primitive types int, double, and boolean 
  4. Arithmetic operators: +, -, *, /, % 
  5. The increment/decrement operators ++ and -- 
  6. The assignment operator = and the combined arithmetic/assignment operators +=, -=, *=, /=, %= are part of the AP Java subset although
    ( they are used simply as a shorthand and will not be used in the adjustment part of a for loop.)
  7. Relational operators ==, !=, <, <=, >, >= .
  8. Logical operations &&, ||, ! .
    Understand the "short circuit" evaluation of the && and || operators. .
  9. The numeric casts (int) and (double) 
    Understand "truncation towards 0" behavior as well as the fact that positive floating-point numbers can be rounded to the nearest integer as (int)(x + 0.5), negative numbers as (int)(x - 0.5).
  10. String concatenation + t converts numbers to strings and invokes toString on objects.
  11. The escape sequences inside strings \\, \", \n 
  12. User input is not part of the AP Java subset.
    if reading input is necessary, it will be indicated in a way similar to the following:
    double x = call to a method that reads a floating-point number;
    double x = IO.readDouble(); // read user input
  13. Testing of output is restricted to System.out.print and System.out.println. 
  14. The main method and command-line arguments are not in the subset. In case studies, program invocation with main may occur, but the main method will be kept very simple.
  15. Arrays: one-dimensional arrays and two-dimensional rectangular arrays are part of the AP Java subset. Both arrays of primitive types (e.g., int[]) and arrays of objects (e.g., Student[] ) are in the subset. Initialization of named arrays (int[] arr = { 1, 2, 3 };) is part of the AP Java subset. Two-dimensional arrays will only be tested on the AB exam. ?
  16. Method overloading (e.g. MyClass.method(String str) and MyClass.method(int num)) is part of the AP Java subset. Know that the signature of a method depends only on the number, types, and order of the parameters, and not on its return type.
  17. Classes: Construct objects with the new operator, to supply construction parameters, and to invoke accessor and modifier methods. Modify existing classes (by adding or modifying methods and instance variables). Design your own classes.
  18. Visibility: In the AP Java subset, all classes are public. All instance variables are private. Methods, constructors, and constants (static final variables) are either public, or private.
  19. The final keyword is only used for final block scope constants and static final class scope parameters or instance variables, final methods and final classes are not in the subset.
  20. The concept of static methods is a part of the subset. Understand when the use of static methods is appropriate. In the exam, static methods are always invoked through a class, never an object (i.e., ClassName.method(), not obj.method()).
  21. static final variables
  22. The null referencet.
  23. The use of this is restricted to passing the implicit parameter in its entirety to another method (e.g., obj.method(this)) and to descriptions such as "the implicit parameter this".
  24. The use of super to invoke a superclass constructor (super(args)) or to invoke a superclass method (i.e., super.method(args)) is part of the AP Java subset.
  25. Implement constructors that initialize all instance variables. Class constants are initialized with an initializer:
    public static final int MAX_SCORE = 5;
  26. Extend classes and implement interfaces. Know inheritance including understanding the concepts of method overriding and polymorphism. Implement your own subclasses.
  27. Read the definitions of interfaces and abstract classes and understand that the abstract methods need to be redefined in non-abstract classes. Write interfaces or class declarations when given a general description of the interface or class. On the AB exam, students are expected to define their own interfaces and abstract classes.
  28. Uunderstand the difference between object equality (equals) and identity (==).
  29. Conversion from a subclass reference to a superclass reference is legal and does not require a cast. Class casts (generally from Object to another class) are part of the AP Java subset, to enable the use of generic collections, for example:
  30. Person p = (Person)people.get(i);
  31. Have a basic understanding of packages and a reading knowledge of import statements of the form
  32. import packageName.subpackageName.ClassName;
  33. import statements with a trailing *, packages and methods for locating class files (e.g., through a class path) are not in the subset.
  34. Understand the exceptions that occur when their programs contain errors (in particular, NullPointerException, ArrayIndexOutOfBoundsException, ArithmeticException, ClassCastException, IllegalArgumentException). On the AB exam, students are expected to be able to throw the unchecked IllegalStateException and NoSuchElementException in their own methods (principally when implementing collection ADTs). Checked exceptions are not in the subset. In particular, the try/catch/finally statements and the throws modifier are not in the subset.