Ask Question

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

+2
Answers (1)
  1. 8 October, 01:29
    0
    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".
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “If you write a toString method to display the contents of an object, object1, for a class, Class1, then the following two statements are ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers