Programming II Midterm

¡Supera tus tareas y exámenes ahora con Quizwiz!

Term used for the relationship created by object aggregation:

"Has a"

What tells the Java compiler that a method is meant to override a method in the superclass?

@Override

The _____ class is the wrapper class for the char data type.

Character

Status methods are called from an instance of the class. T/F

False

The following statement correctly creates a StringBuilder object: StringBuilder str = "Tuna sandwich"; T/F

False

Which of the following is true about protected access?

Protected member may be access by methods in the same package or in a subclass, even when the subclass is in a different PACKAGE.

If you have defined a class, SavingsAccount, with a public static method, getNumber0fAccounts, and created a SavingsAccount object referenced by the variable account 20, which of the following will call the getNumber0fAccounts method?

SavingsAccount.getNumberOfAccounts( );

Which of the following will convert the double variable?

String str = Double.toString(d);

If the following is from the method section of a UML diagram, which of the statements below is true? + equals (object2:Stock) : boolean

This is a public method that accepts a stock object as its argument and returns a boolean value.

Given the following: 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. T/F

True

When a subclass overrides a superclass method, only the subclass's version of the method can be called with a subclass object. T/F

True

When an object is passed as an argument, it is actually a reference to the object that is passed. T/F

True

When an object reference is passed to a method, the method may change the values in the object. T/F

True

What will be displayed after the following code is executed? String str = "RSTUVWXYZ"; System.out.println(str.charAt(5));

W

The stringBuilder class's insert method allows you to insert?

char array, primitive type, String object

Which key indicate that a class inherits form another class?

extends

If str is declared as String str = "ABCDEFGHI"; what will be returned from Character.toLowerCase(str.charAt(5))?

f

The JVM periodically performs the ________ process to remove unreferenced objects from memory.

garbage collection

Which of the following is the operator used to determine whether an object is an instance of a particular class?

instanceOf

An example of a 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.

If a class contains an abstract method?

must create an instance of the class, the method will only have a header, but no body, and will end with a semicolon, and cannot be overridden in subclasses.

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 (.)

When declaring class data members it is best to declare them as?

private members

An example of two interfaces being specified:

public class ClassA implements Interface1, Interface2

What will be displayed after the following statements are executed? String str = "red$green&blue#orange"; String[] tokens = str.split (" [$&#]"); for (String s : tokens) System.out.print (s + " ");

red green blue orange

What would be the result of executing the following code? StringBuilder str = new StringBuilder ("Little Jack Horner "); str.append ("sat on the "); str.append ("corner");

str would reference 'Little Jack Horner sat on the corner"

The process of breaking a string down into tokens is known as?

tokenizing


Conjuntos de estudio relacionados

Modern Database Management - Final Study

View Set

History 101 FINAL EXAM cummulative

View Set

Types Of Individual Life Insurance

View Set

Chapter 8 Understanding populations

View Set

Spanish Quiz la familia (husband-aunt)

View Set