Java OOP doubt? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Java OOP doubt?

If I have class named wheels then how can I call 4 different methods from wheels class to the main class with an array list (collection) as four different object.

15th Apr 2017, 10:18 PM
Dona Varghese
Dona Varghese - avatar
2 Answers
+ 2
Here's an example on how to call methods from a class in the main class. https://code.sololearn.com/c9Febn4nC2Ux/?ref=app
16th Apr 2017, 12:32 AM
Hassie
Hassie - avatar
+ 1
you could also use interfaces if you wish to run different code every time a method is called. https://code.sololearn.com/cWgLCkjFySW5/?ref=app
16th Apr 2017, 10:56 AM
Hassie
Hassie - avatar