The - indicates a class' private item.
True
False - answer true
The + indicates additional private items.
True
False - answer false
In addNumYears(), which line adds the parameter numYears to the existing value of
field numYears?
this.numYears = this.numYears + numYears;
this.numYears = numYears + numYears;
numYears = this.numYears + numYears; - answer a
In addNumYears(), which line assigns the field numYears with 0?
numYears = 0;
this(numYears) = 0;
this.numYears = 0; - answer c
In addNumYears(), which line assigns the field numYears with the parameter
numYears?
numYears = this.numYears;
this.numYears = numYears; - answer b
Long id = 12398L;
Autoboxing
Unboxing
Both - answer a
Boolean lowStock = itemCount < 10;
Autoboxing
Unboxing
Both - answer a
Assume newRate is a double and adjustRate is a Double.
newRate *= adjustRate;
Autoboxing
, Unboxing
Both - answer b
Assume newTime is a double, and totalTime is a Double.
totalTime = totalTime + newTime;
Autoboxing
Unboxing
Both - answer c
Assume the calcResult() method returns an Integer and has the signature
calcResult(Integer num1, Integer num2), and that variables xVal and yVal are of type
int.
Integer zVal = calcResult(xVal, yVal);
Autoboxing
Unboxing
Both - answer a
API is short for ___.
Authoring Program Instructions
Applied Programming Implementation
Application Programming Interface
Automated Program Instructions - answer c
What is the blueWidget's inStock at the end of main( )?
public class Widget {
private int inStock;
public Widget() {
inStock = 10;
}
public void addInventory(int amt) {
inStock = inStock + amt;
}
public static void main(String [] args){
Widget blueWidget = new Widget();
Widget greenWidget = new Widget();
blueWidget.addInventory(15);
greenWidget.addInventory(5);
}
}
}
25
10
30