Question: How to write toString method for Date class? Students should be able to write the toString() method for the class given the String representation of
Students should be able to write the toString() method for the class given the String representation of a class object. The String representation of Date class object is: mm/dd/yyyy or 02/13/2015. Write the toString() method for Date class. public String toString() {return String.format("%02d/%02d/%d", month, day, year);}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
