Ask Question
6 September, 14:46

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.

+4
Answers (1)
  1. 6 September, 17:11
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers