Java program to override toString method

Java » Java program to override toString method

An object class contains a variety of predefined methods, toString is one of them. We need to override it first, to get a desirable output.

Program:

 

Output:


You must be logged in to take the quiz.

error: Content is protected !!