0

When I print the object array out, the output is Project.Class. The intended output is to show each object.

The array has already been declared outside of the method.

I tried using mutators however the output was the same.

1
  • 1
    override ToString() on your Station Class Commented Dec 20, 2018 at 13:53

2 Answers 2

3

The problem is your Console.WriteLine(stations[i]);. You've not posted your stations object definition but you need to reference what properties you want to show. Otherwise you will just write out your object.

Console.WriteLine(stations[i].stationNo);
Console.WriteLine(stations[i].stationName);
Sign up to request clarification or add additional context in comments.

Comments

0

You can override ToString() method of that object class and emplement the method to return the specific properties what you want to print. And inisde a loop you can call that ToString() method of that object to print that object information.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.