Which of the following is used to allocate memory for the instance variables of
ID: 3687442 • Letter: W
Question
Which of the following is used to allocate memory for the instance variables of an object of a class? What is the default definition of the method to String? Suppose that Book is class with two instance variables-names of type String and num Of Books of type int. Which of the following would be appropriate syntax for the heading of a copy constructor for the called Book? How many finalizers can a class have? When does the method finalize can a class have? When does the method finalize execute? Which of the following words indicates an object's reference to itself? What is the main use of inner classes? Which of the following declares an array of int named beta? Which of the following is the array subscripting operator in Java?Explanation / Answer
31. c. The operator new
32. b. It creates a string that is the name of the object's class, followed by the hash code of the object.
33. c. public Book(Book b)
Copy constructor has the same name as name of the class. Name of copy constructor is Book and Copy constructor takes an object of Book as argument
34. c. one
Finalizer is called while destructing object to cleanup the memory. Only finalizer is required for this
35. d. when the class object goes out of scope
Java automatically deallocates an object when it goes out of scope and it uses finalize method to deallocate
36. a. this
All member functions uses this to indicate object's reference to itself
37. d. to provide information hiding.
Soppuse class B is used by only class A then making clas B as inner class of class A hides class B to all other classes
38. c. int[] beta;
To allocate memory to the array we need new operator
39. d. []
We retrieve elements of array using [] opeerator
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.