Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the role of to String in java programming?
What is the role of to String in java programming?
ToString is an existing method in object, and all classes inherit from object, so "all objects have this method".

Usually just for the convenience of output, such as System.out.println(xx). If the "XX" in parentheses is not a string type, the toString () method of xx will be called automatically.

In a word, it is just a method specially added by sun Company to facilitate the string operation of all classes when developing java.