21. What is the use of toString function?The toString function gets automatically inherited in all java classes from the Object class. We can override the toString function. Whenever we print an object of a class, by default the toString function of the class gets called. So if we want to give a customizable output when printing an object, we can override the toString … [Read more...] about Important Core Java Interview Questions and Answers in 2025