Jump to page content Jump to navigation

College Board

AP Central

AP Exam Reader
Siemens Awards for Advanced Placement

APAC 2010
Print Page
Home > Computer Science A: Quick Reference Guide

Computer Science A: Quick Reference Guide

class java.lang.Object
// all classes inherit and may override these methods

  • boolean equals(Object other)
  • String toString()
interface java.lang.Comparable
  • int compareTo(Object other)
    // return value // return value = 0 if this is equal to other
    // return value > 0 if this is greater than other class java.lang.Integer implements java.lang.Comparable
    • Integer(int value)
      // constructor
    • int intValue()
    class java.lang.Double implements java.lang.Comparable
    • Double(double value)
      // constructor
    • double doubleValue()
    class java.lang.String implements java.lang.Comparable
    • int length()
    • String substring(int from, int to)
      // returns the substring beginning at from
      // and ending at to-1
    • String substring(int from)
      // returns substring(from, length())
    • int indexOf(String s)
      // returns the index of the first occurrence of s;
      // returns -1 if not found
    class java.lang.Math
    • static int abs(int x)
    • static double abs(double x)
    • static double pow(double base, double exponent)
    • static double sqrt(double x)
    class java.util.Random
    • int nextInt(int n)
      // returns an integer in the range from 0 to n-1 inclusive
    • double nextDouble()
      // returns a double in the range [0.0, 1.0)
    class java.util.ArrayList
    • int size()
    • boolean add(Object x)
      // appends x to the end of list; returns true
    • Object get(int index)
      // returns the element at the specified position
    • Object set(int index, Object x)
      // replaces the element at index with x
      // returns the element formerly at the specified position
    • void add(int index, Object x)
      // inserts x at position index, sliding elements
      // at position index and higher to the right
      // (adds 1 to their indices) and adjusts size
    • Object remove(int index)
      // removes element from position index, sliding elements
      // at position index + 1 and higher to the left
      // (subtracts 1 from their indices) and adjusts size
      // returns the element formerly at the specified position



  ABOUT MY AP CENTRAL
    Course and Email Newsletter Preferences
  AP COURSES AND EXAMS
    Course Home Pages
    Course Descriptions
    The Course Audit
    Sample Syllabi
    Teachers' Resources
    Exam Calendar and Fees
    Exam Questions
    FAQs
  PRE-AP
    Teachers' Corner
    Workshops
  AP COMMUNITY
    About Electronic Discussion Groups
    Become an AP Exam Reader

Back to top