a class specifies the ________ and ________ that a particular type of object has.

a class specifies the ________ and ________ that a particular type of object has.


S
Asked by 2 years ago
9.9k points
A class specifies the ________ and ________ that a particular type of object has.fields; methods
In the cookie cutter metaphor, think of the ________ as a cookie cutter and ________ as the cookies.class; objects
In your textbook the general layout of a UML diagram is a box that is divided into three sections. The top section has the _______; the middle section holds _______; the bottom section holds _______.class name; attributes or fields; methods
The scope of a private instance field is the instance methods of the ____ ______.same class
For the following code, which statement is not true? public class Circle { private double radius; public double x; private double y; } a. x is available to code that is written outside the Circle class. b. radius is not available to code written outside the Circle class. c. radius, x, and y can be referenced by all instance methods of the Circle class. d. y is available to code that is written outside the Circle class.d. y is available to code that is written outside the Circle class.
A static field is created by placing a. the key word static after the field name b. the key word static after the access specifier and before the field's data type c. the key word static after the access specifier and field's data type d. it in a static field blockb. the key word static after the access specifier and before the field's data type
When a method's return type is a class, what is actually returned to the calling program? a. An object of that class b. A reference to an object of that class c. Only the values in the object that the method accessed d. Nothing, the return type is strictly for documentation in this situationb. A reference to an object of that class
If object1 and object2 are objects of the same class, to make object2 a copy of object1 a. assign object1 to object2, such as object2 = object1; b. write a copy method that will make a field by field copy of object1 data members into object2 data members c. use the Java copy method that is a part of the Java language d. use the default constructor to create object2 with object1 data membersb. write a copy method that will make a field by field copy of object1 data members into object2 data members
If you have defined a class SavingsAccount with a public static method getNumberOfAccounts(), and created a SavingsAccount object referenced by the variable account20, which of the following will call the getNumberOfAccounts()method? a. getNumberOfAccounts(); b. SavingsAccount.getNumberOfAccounts(); c. getNumberOfAccounts(account20); d. None of the above, you cannot call a static method.b. SavingsAccount.getNumberOfAccounts();
Assume the class BankAccount has been created, and the following statement correctly creates an instance of the class: BankAccount account = new BankAccount(5000.0); What is true about the following statement? System.out.println(account); a. The method will display unreadable binary data on the screen. b. A compiler error will occur. c. The account objects toString method will be implicitly called. d. A runtime error will occur.c. The account objects toString method will be implicitly called.
What will be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5}; a. An array of 6 values ranging from 0 through 5 and referenced by the variable x will be created b. A compilation error will occur c. The program will crash when it is executed d. The value of x[1] will be 0, x[2] will be 0, x[3] will be 0, x[4] will be 0, x[5] will be 0, and x[6] will be 0.a. An array of 6 values ranging from 0 through 5 and referenced by the variable x will be created
An array of String objects a. consists of elements, each of which is a reference to a String object. b. always holds String objects of the same length. c. consists of elements, each of which is a String object. d. must be initialized when the array is declared.a. consists of elements, each of which is a reference to a String object.
What would be the results of the following code, assuming array nums has been properly instantiated and populated? int x = 0; for (int k = 0; k < nums.length; k++) { x += nums[k]; } a. x contains the highest value in nums b. x contains the lowest value in nums c. x contains the sum of all the values in nums d. This would cause the program to crashc. x contains the sum of all the values in nums
What will be the value of x[0] after the following code is executed? int[] x = {11, 22, 33}; process(x); : public static void process(int[] a) { for(int k = 0; k < a.length; k++) { a[k] = a[k] + 1; } } a. 11 b. 12 c. 22 d. 0b. 12
A class in not an object, but a description of an object. T or F??T
A constructor is a method that Performs _______ or _______ operations.Performs initialization or setup operations.
It is common practice in object-oriented programming to make all of a class's fields _____.private
Methods that operate on an object's fields are called _______ methods.instance
Overloading means multiple methods in the same class have the same _____, but different ______ lists.name; parameter
Quite often you have to use this statement: ______ to make a group of classes available to a program.import
The scope of a private instance field is the instance methods of ___ ______ class.the same
Two or more methods in a class may have the same name as long as they have different _____ _____.parameter lists
What is stored by a reference variable?an object
A search algorithm arranges elements in ______ order.ascending
Each array in Java has a public field named ________ that contains the number of elements in the array.length
If final int SIZE = 15 and int[] x = new int[SIZE], what would be the range of subscript values that could be used with x[]? ( ## through ##)0 through 14
In Java, you do not use the new operator when you use a(n) _______ list.initialization
Java performs array ________ _______, which means that it does not allow a statement to use a subscript that is outside the range of valid subscripts for the array.bounds checking
Subscript numbering always starts at what value?0
a class
studybud

Your Answer

Surround your text in *italics* or **bold**, to write a math equation use, for example, $x^2+2x+1=0$ or $$\beta^2-1=0$$

Use LaTeX to type formulas and markdown to format text. See example.

Sign up or Log in

  • Answer the question above my logging into the following networks
Sign in
Sign in
Sign in

Post as a guest

  • Your email will not be shared or posted anywhere on our site
  •  

Stats
Views: 44
Asked: 2 years ago

Related