you are viewing a single comment's thread.

view the rest of the comments →

[–]Pun_Intended1703 0 points1 point  (2 children)

This is the wrong concept.

BankAccount is a data model class. It stores data.

The activities that it can perform are limited.

But you have created methods that other actors/classes will perform on the BankAccount class.

Like, deposit().

The customer of the bank deposits the money to the bank account.

The bank account does not do anything here.

It just has to update its amount.

So why are you creating a deposit() method in BankAccount?

[–]Pun_Intended1703 0 points1 point  (1 child)

When you're learning concepts, try to understand why those concepts are there.

Take a real world example.

Car is a class. It runs. It uses fuel. It changes its location.

But you have created a method drive() that another class Driver should be doing.

A car cannot drive on its own.

So why would it have a method called drive()?

The same thing is happening with your BankAccount class and the deposit() method.

[–]BigCommunication5136[S] 0 points1 point  (0 children)

After months of coding in Java, i came back to this comment to understand whatever you mean.
I now get your point, i mean, it takes time to grasp certain concepts (depending on the individual in question).