Question 1 of 10
What is a class method associated with?
- A. One particular object that must already exist
- B. The class itself, not an individual instance
- C. Only the Scanner keyboard object
- D. Only a local variable inside main
What is a class method associated with?
Class RadioTower defines public static int watts(). Which call is the usual class-qualified form from another class?
When may the class name be omitted in a call to an accessible class method at this topic level?
RadioTower is documented below. What value does power hold after this code runs?
| Member | Kind | Contract |
|---|---|---|
| watts | class method | returns 50 |
| boost | class method | returns 50 plus the given int |
int power = RadioTower.watts();
Using the same RadioTower contract (watts returns 50; boost(int extra) returns 50 + extra), what value is displayed?
System.out.print(RadioTower.boost(8));
RadioTower.watts() returns 50. What value does total hold?
int total = RadioTower.watts() + 12;
These methods are both in class RadioTower. What value does RadioTower.report() return?
public static int watts()
{
return 50;
}
public static int report()
{
return watts() + 5;
}
Class Antenna does not define watts. RadioTower defines public static int watts() returning 50. Which statement about this code in Antenna is true?
int n = watts();
RadioTower.band() returns 2 and RadioTower.offset(int n) returns n + 7. What value is displayed?
System.out.print(RadioTower.offset(RadioTower.band()));
RadioTower.log() is a public static void method that prints TX. What text does this code display?
System.out.print("ON");
RadioTower.log();
System.out.print("OFF");