Pre-AP Computer Science ACP Topics 2nd Semester 2012

advertisement
Pre-AP Computer Science ACP Topics
2nd Semester
2012-2013
Vocabulary:
1st semester vocabulary
finite limits of numeric data
a. overflow (int and double)
b. underflow (int and double)
c. loss of precision (double)
d. Integer.MAX_VALUE,
Integer.MIN_VALUE
3. Boolean Algebra
4. DeMorgan's Law
5. truth tables
6. control structures
a. selection
b. repetition
7. Using objects - client code
8. Object Oriented Programming (OOP)
9. Objects have
a. behavior
b. state
c. identity
10. instantiate (instantiation)
11. objects and object references
12. class
1.
2.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
polymorphism
encapsulation
information hiding
overloading
overriding
class / object members
constructor
instance variable
class constant
methods
a. accessor
b. modifier
parameters
a. formal
b. actual
scope
a. global
b. local
inheritance
superclass / subclass
Array
Exceptions
Specific Java language features:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
1st semester Specific Java language features
String class methods
(see ACP Quick Reference for methods)
evaluating Boolean expressions
a. comparing two values for equality
(ints, doubles, Strings)
b. relational operators (==, !=, <, >, <=, >=)
c. logical operators (!, &&, ||)
1-way, 2-way, multi-way selection
if, if…else, cascading if, nested if
for, while
a. infinite
b. nested
new
static
final
class
public / private
overriding methods
overloading constructors
14. overloading methods
15. use of toString method
16.
17.
18.
19.
a. explicit and implicit calls
b. overriding toString method
extends
super
public class Derived extends Base
Arrays
a. how to construct
b. access the length of array (arr.length)
c. ArrayIndexOutOfBoundsException
d. access an element of the array
e. traversals
i.
printing
ii.
summing
iii.
counting
f. modify data
g. simple search(does not include binary search)
i.
find large
ii.
find small
PRE-AP COMPUTER SCIENCE
ACP QUICK REFERENCE
Accessible Methods from the Java Library That May Be Included on the Exam
class java.lang.Object
• boolean equals(Object other)
• String toString()
class java.lang.Integer
• Integer.MIN_VALUE
• Integer.MAX_VALUE
// minimum value represented by an int or Integer
// maximum value represented by an int or Integer
class java.lang.String (inherits equals
• int length()
• String substring(int from, int to) //
//
• String substring(int from)
//
• int indexOf(String str)
//
//
• int compareTo(String other)
//
//
//
and toString from Object)
returns the substring beginning at from
and ending at to-1
returns substring(from, length())
returns the index of the first occurrence of str;
returns -1 if not found
returns a value < 0 if this is less than other
returns a value = 0 if this is equal to other
returns a value > 0 if this is greater than other
class java.lang.Math
• static int abs(int x)
• static double abs(double x)
• static double ceil(double x)
• static double floor(double x)
• static double pow(double base, double exponent)
• static double sqrt(double x)
• static double random()
// returns a double in the range [0.0, 1.0)
class java.util.Scanner
• String next()
// Finds and returns the next complete token from this scanner
• String nextLine()
// Returns the rest of the current line, excluding any line separator at the end.
// The position is set to the beginning of the next line.
•
String nextInt()
•
String nextDouble() // Scans the next token of the input as a double
// Scans the next token of the input as an int
Download