should we create two objects for two methods in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

should we create two objects for two methods in java

methods

30th Nov 2019, 6:22 PM
Ajoh Pv
Ajoh Pv - avatar
3 Answers
+ 2
No Because we create object of class so if that methods are in same class then we can call through single object.
30th Nov 2019, 6:37 PM
A͢J
A͢J - avatar
0
No, one object is enough to invoke both the methods of the class.
30th Nov 2019, 6:31 PM
Avinesh
Avinesh - avatar
0
if you need only one object with two mehtods then no, if you need many objets with two methods then yes I suppose you understand difference between class and object
1st Dec 2019, 8:31 PM
zemiak