educative.io

For a single space the ouput showing full wrong to me is this acceptble

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

Hi @Estiak

Kindly verify it again.
The space after the comma won’t affect the output because the comma/space is written with " ". So, with or without space the correct output is shown as below:


Hope it will help, Happy Learning :slight_smile: