9
fields private
It is common practice in object-oriented programming to make all of a class's: methods private fields private fields public fields and methods public
String
Java allows you to create objects of this class in the same way you would create primitive variables. Random String PrintWriter Scanner
an explicit import
Look at the following statement. import java.util.Scanner; This is an example of a wildcard import an explicit import unconditional import conditional import
object-oriented
Most programming languages that are in use today are: procedural logic object-oriented functional
class
One or more objects may be created from a(n): field class method instance
c
Overloading means multiple methods in the same class: a) have the same name, but different return types b) have different names, but the same parameter list c) have the same name, but different parameter lists d) perform the same function
import
Quite often you have to use this statement to make a group of classes available to a program. import use link assume
java.lang
The following package is automatically imported into all Java programs. java.java java.default java.util java.lang
a
The scope of a private instance field is: a) the instance methods of the same class b) inside the class, but not inside any method c) inside the parentheses of a method header d) the method in which they are defined
package
This is a group of related classes. archive package collection attachment
encapsulation
This refers to the combining of data and code into a single object. Data hiding Abstraction Object Encapsulation
b
Two or more methods in a class may have the same name as long as: a) they have different return types b) they have different parameter lists c) they have different return types, but the same parameter list d) you cannot have two methods with the same name
a memory address
What is stored by a reference variable? A binary encoded decimal A memory address An object A string
instance fields
When an object is created, the attributes associated with the object are called: instance fields instance methods fixed attributes class instances
the objects memory address
When an object is passed as an argument to a method, what is passed into the method's parameter variable? the class name the object's memory address the values for each field the method names
primitive variable
When you are working with a ________, you are using a storage location that holds a piece of data. primitive variable reference variable numeric literal binary number
all of these
Which of the following are classes from the Java API? Scanner Random PrintWriter All of these
a
Which of the following statements will create a reference, str, to the String, "Hello, World"? a) String str = "Hello, World"; b) string str = "Hello, World"; c) String str = new "Hello, World"; d) str = "Hello, World";
c
Which of the following statements will create a reference, str, to the string, "Hello, world"? a) 1 b) 2 c) 1 and 2 d) neither 1 or 2
a
You should not define a class field that is dependent upon the values of other class fields: a) in order to avoid having stale or inconsistent data b) because it is redundant c) because it should be defined in another class d) in order to keep it current