Programming II Midterm
The StringBuilder class's insert method allows you to insert an ___ into the calling's object's string
Char array Primitive type String object
Wrapper class for the char data type
Character class
True/False | static methods are called from an instance of a class
False
Is [ StringBuilder str = "Tuna sandwich"; ] correct?
No
Defined class: SavingsAccount Public static method: getNumberOfAccounts Class object: referenced by account20 variable Which will call getNumberOfAccounts
SavingsAccount.getNumberOfAccounts();
Which of the following statements will convert the double variable, d = 543.98 to a string?
String str = Double.toString(d);
Breaking a string down into tokens
Tokenizing
enum Tree {OAK, MAPLE, PINE} What is the fully-qualified name of the PINE enum constant?
Tree.Pine
A wrapper class is a class that is "wrapped around" a primitive data type and allows you to create objects instead of variables.
True
Protected members may be accessed by methods in the same package or in a subclass, EVEN when the subclass is in a different package
True
When a subclass overrides a superclass method, only the subclass's version of the method can be called with a subclass object.
True
When an objects method is passed as an argument, it is actually a reference to the object that is passed
True
If a class contains an abstract method
Umm
Which key word indicates that a class inherits from another class?
extends
Character.toLowerCase(star.charAt(5))
f
The JVM periodically performs the ___ process to remove unreferenced objects from memory
garbage collection
is the term for the relationship created by object aggregation
has a
example of lambda expression
int x = x * factor;
When the this variable is used to call a constructor
it must be the first statement in the constructor making the call
You cannot use the == operator to compare the contents of
objects
A subclass may call an overridden superclass method by:
prefixing its name with the super key word and a dot (.)
Correctly specifies two interfaces
public class ClassA implements Interface1, Interface2