HELP |  STORE |  SEARCH:              STUDENTS | PARENTS | EDUCATORS
CollegeBoard for Educators
 
Print Page
 > The Courses > Course Home Pages > Computer Science A: Quick Reference Guide

Computer Science A: Quick Reference Guide

Teacher
Computer Science AB
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 < 0 if this is less than other
    // 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
See also...
 Computer Science A & AB: Introduction of Java in 2003-2004
 Computer Science AB: Quick Reference Guide

CONTACT |  CAREERS |  ABOUT US |  PRIVACY |  TERMS OF USE |  PRESS
Copyright © collegeboard.com, Inc.
  MY AP CENTRAL
    Personal Profile
   THE COURSES
    Course Home Pages
    Course Descriptions
    Sample Syllabi
   THE PROGRAM
    Starting an AP Program
    Achieving Equity
    AP Research and Data
    AP Scholar Awards
    AP International
   PRE-AP
    Teachers' Corner
    Workshops
    Publications
    FAQs
   HIGHER EDUCATION
    Setting Credit and Placement Policy
    Course and Exam Development
    AP Research
    Find Credit Policy Information
    Get Involved
   PROFESSIONAL DEVELOPMENT
    About Institutes and Workshops
    Online Events
    Getting Started for Teachers
    Professional Development Research
    Become an AP Exam Reader
    Become a Consultant
    College Board Fellows
   THE EXAMS
    All About the Exams
    Exams Calendar
    For Coordinators
    Fees & Reductions
    Exam Questions
    Exam Tips