Consider the following code: MyClasscls = new MyClass("Test Class"); System.out.println(cls); What is the best implementation for printing "Test Class" to the output?
Correct Answer: Override the toString method in this class and return the string which passes in the constructor.
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More Java MCQ Questions