1. Engineering
  2. Computer Science
  3. which of the following statements about constructors are true select...

Question: which of the following statements about constructors are true select...

Question details

Which of the following statements about constructors are TRUE? Select all that apply A constructor header consists of the keyword public, followed by the return type, followed by the class name, e.g. public void Point The keyword this can be used in a constructor to call another constructor A constructor is called when the client uses the keyword new along with the class name followed by parameters, if any,e.g. Point p-new PointO When a class does not provide a constructor, Java automatically supplies a default constructor with no parameters that initializes all fields to zero-equivalent values It is possible to define more than one constructor inside any class definition Partial Question 6 1/1.5 pts Which of the following statements about encapsulation are TRUE? Select all that apply. As a general rule, in order to maintain encapsulation all class methods should be made private The keyword public is used to make class components accessible to other classes As a general rule, in order to maintain encapsulation class fields should be made private Encapsulation hides internal state of objects from outside viewartial Question 8 0.5/1.5 pts Which of the following statements about class invariant are TRUE? Select all that apply A class invariant is an implicit postcondition for all class methods A class invariant is an assertion about an objects state that is true for the lifetime of that object The class invariant discussion presented in the textbook focuses on an invariant that ensures that the x and y coordinates of Point are always positive A class invariant is an implicit precondition for all class methods

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution