If you write a toString method to display the contents of an object, object1, for a class, Class1, then the following two statements are equivalent: System.out.println(object1); System.out.println(object1.toString()); A. True B. False

Respuesta :

Answer:

The answer is "Option A".

Explanation:

In the given question the method toString() is used that converts any value into a string. In this code two print method is used, that can be described as follows:

  • In the first method, object1 is created, which is used to print all object values.
  • In the second method, object1 uses the toString() method, which converts all values into a string, that's why the answer to this question is "True".

ACCESS MORE
EDU ACCESS
Universidad de Mexico