- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the purpose of toString() method? Or What does the toString() method do in java?
The toString() method returns the current object in String format.
Example
public class Test { public static void main(String args[]) { Test obj = new Test(); System.out.println(obj.toString()); System.out.println("Hello"); } }
Output
Test@2a139a55 Hello
Advertisements