Page 596 - AP Computer Science A, 7th edition
P. 596
(B) getModel()
(C) displayCar()
(D )
setPrice(newPrice) (E) getYear()
//returns model of Car
//displays all features of Car
//sets price of Car to newPrice
//returns year of Car
20. Consider the following segment of code.
String word = “conflagration”; int x = word.indexOf(“flag”); String s = word.substring(0, x);
What will be the result of executing the above segment?
(A) A syntax error will occur.
(B) String s will be the empty string. (C) String s will contain “flag”.
(D) String s will contain “conf”.
(E) String s will contain “con”.
21. Consider the following class declaration:
public abstract class AClass {
private int v1; private double v2;
//methods of the class ...
}
Which is true about AClass?
(A) Any program using this class will have an error: An abstract class cannot contain private instance variables.
newColor