in getDetails function if i left out a single space after the “,” comma the ouput showing a full test case wrong where if i give ", " like this it showing correct
// Derived Class
class Car extends Vehicle{ // This line needs to be changed.
public String name; // Name of a Car
public Car() { // Default Constructor
name = "";
}
// This function sets the name of the car
public void setDetails(String name) { // Setter Function
this.name = name;
}
// This function calls the Base class functions and appends the input to the result
public String getDetails(String carName) {
String details = carName + "," + getModel() + "," + getSpeed();
// write your code here
return details;
}
}
Course: Learn Object-Oriented Programming in Java - Learn Interactively
Lesson: Challenge 1: Implement the Derived Class - Learn Object-Oriented Programming in Java