In: Computer Science
In the following Java class, what would the following createFromString(String string) and saveToString() methods return?
/**
* This class represents a DVD player to be rented.
*
* @author Franklin University
* @version 2.0
*/
public class DVDPlayer extends AbstractItem
{
/**
* Constructor for objects of class DVDPlayer.
*/
public DVDPlayer()
{
// No code needed
}
/**
* Creates a DVDPlayer from a string in the format
* id:desc:weeklyRate:rented
* @param string The string
* @return the new DVDPlayer
*/
public static DVDPlayer createFromString(String string) {
return null;
}
@Override
public String saveToString() {
return null;
}
}
In the above java class the above functions createFromString(String string) and saveToString() both return "null".
Even though the return type for both functions are class type and string respectively however, they both return null values irrespective of the return type null values doesn't depend on them i.e., null is returned for all the inputs.
Hence so here I attach to clarify any further doubts the implemented code and outputs respectively.PS I've used some example strings for ease.
Thank you.