Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Java (Chapter 9)

Classes/Objects

QuestionAnswer
9.1 ____________ represents an entity in the real world that can be distinctly identified. An object
9.2 _____________ is a construct that defines objects of the same type. A class
9.3 An object is an instance of a _________ . class
9.4 The keyword ________ is required to declare a class. class
9.5 ___________ is invoked to create an object. A constructor
9.6 [True or False] A default constructor is provided automatically if no constructors are explicitly declared in the class. True
9.6 [T/F] At least one constructor must always be defined explicitly. False
9.6 [T/F] Every class has a default constructor. False
9.6 The default constructor is a no-arg constructor. True
9.7 [T/F] Multiple constructors can be defined in a class. True
9.7 [T/F] Constructors do not have a return type, not even void. True
9.7 [T/F] Constructors must have the same name as the class itself. True
9.7 [T/F] Constructors are invoked using the “new” operator when an object is created. True
9.12 The default value for data field of a “boolean” type, “numeric” type, “object” type is _______, respectively. false, 0, null
9.13 [T/F] Local variables do not have default values. True
9.13 [T/F] Data fields have default values. True
9.13 [T/F] A variable of a primitive type holds a value of the primitive type. True
9.13 [T/F] A variable of a reference type holds a reference to where an object is stored in the memory. True
9.13 [T/F] You may assign an int value to a reference variable. False
9.10 Explain the given the declaration of “Circle x = new Circle()”. “x” is the reference variable that can reference a “Circle” object or null if it does not reference any object.
9.17 [T/F] A reference variable is an object. False because a reference variable is not an object, it is a reference that points to an object.
9.17 [T/F] A reference variable references to an object. True
9.17 [T/F] A data field is a class must be a primitive type. False because a class may have a data field of an object type such as a String.
9.17 [T/F] A data field in a class can be of an object type. True
9.19 [T/F] When creating a Random object, you have to specify the seed or use of the default seed. A “seed” is a number used to initialize a random number generator. True
9.19 [T/F] If two Random objects have the same seed, the sequence of the random numbers obtained from these two objects are identical. True
9.19 [T/F] The “nextInt()” method in the Random class returns the next random int value. True
9.19 [T/F] The “nextDouble()” method in the Random class returns the next random double value. True
9.20 To obtain the distance between the points (40,50) and (5.5, 4.4), use ___________ . “new Point2D(40,50).distance(5.5,4.4)” or “new Point2D(40,50).distance(new Point2D(5.5,4.4))” “new Point2D(5.5,4.4).distance(40,50)” or “new Point2D(5.5,4.4).distance(new Point2D(40,50))”
9.21 Variables that are shared by every instance of a class are ______________ . class variables
9.23 A method that is associated with an individual object is called ____________ . an instance method
9.24 To declare a constant MAX_LENGTH as a member of the class, you write ____________ . “final static double MAX_LENGTH = 99.98” [A “constant” is known as a final variable and represents permanent data that never changes. The word “final” is a Java keyword for declaring a constant. Format: final data type CONSTANTNAME = value;]
9.29 Suppose the xMethod() is invoked in the following constructor in a class, xMethod() is ______ in the class. [public MyClass() { xMethod(); } ] A static method or an instance method.
9.30 Suppose the xMethod() is invoked from a main method in a class, xMethod() is ______ in the class. [public static void main(String[] args) { xMethod(); } ] a static method
9.31 To prevent a class from being instantiated, ____________ . use the private modifier on the constructor
Created by: Smurfette42
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards