Help in Exception handline | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help in Exception handline

when we throw object of some exception and print using println it describes that exception, but when we use overridden tostring method In userdefine exception , if I throw that exception and print it out shows the tostrings statements ... explain it (in both, we use println to print the thrown object but different output comes )

22nd Aug 2017, 3:32 PM
Sathish
1 Answer
0
When you override a method in a class, instances of that class will perform the overridden method at runtime, rather than the parent method. Both print() and println() call the toString() method.
24th Aug 2017, 11:52 AM
marit vandijk