Ask Question
8 February, 20:58

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.

+5
Answers (1)
  1. 8 February, 21:04
    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 & 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