Ask Question
6 March, 06:16

You have written a class called Frog and have not written a toString method. Frog f = new Frog (); System. out. println (f); What happens when the code above is executed? "Ribbit" is printed. Error - a class cannot be instantiated without the toString method. Error - Frog has no toString method. Nothing happens. The toString method in Object is called.

+3
Answers (1)
  1. 6 March, 08:18
    0
    The correct answer is: ' The toString method in Object is called. ' If you don't explicitly write a ToString () method in your class, the ToString () method in the parent class is called. Your own 'ToString () ' method would overload the parent Object 'ToString () ' method.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “You have written a class called Frog and have not written a toString method. Frog f = new Frog (); System. out. println (f); What happens ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers