5 Tips for the AP Computer Science A Exam

Tip 1  : Floating Point Error!

If you are asked to compare doubles with either “==” or “!=” the answer is probably “Floating point error”!   (demo of floating point error in Java)

 

Tip 2 : Constructors are not inherited!

The code below fails because constructors are not inherited!

public class SuperClass{

}

public class SubClass extends SuperClas{

private String type;

public SubClass( String _type){

this.type= _type:

}

Tip 3 :  Be careful of static methods!

 

Consider the code below:

public class Cat{

public int myName;

}

Cat fluffy = new Cat()

You can NOT write

Cat.myName

Instead you must write

fluffy.myName

Tip 4 :  Abstract Classes != Interfaces

Though they look similar .  For interfaces, all methods are “abstract” (ie they can’t be defined). An abstract class might, or might not, have abstract methods. An abstract class can have normal fully defined methods.

 

Tip 5 :  Selection sort sucks

Though t his does not seem to crop up much on the AP , it’s something that you can easily remember if you happen to see a question on it on the exam. Selection sort is always a slow  algorithm (Slower than insertion). And it always takes the same number of comparisons no matter what the incoming data looks like

 

 

 

There’s not a lot else that you can at this time. The day of the AP  so good luck!