+ 3

What if there are more methods in the class..?

as in the example, dog.bark calls bark method of dog object. what if there are more methods we wanna call...

21st Nov 2016, 4:59 PM
Deepak Tiwari
8 Answers
+ 5
yes you can call all methods same way object.methodtobecalled(parameters); dog.run()
21st Nov 2016, 5:19 PM
Sandeep Chatterjee
+ 4
Object name.method name();
21st Nov 2016, 6:24 PM
Ganesh pandurang apune
Ganesh pandurang apune - avatar
+ 3
you have to create more method to use that methods come either as it's own or its class or class which its class is of. dog=new Animal{ void bark(): .... codes to bark void biter():..... codes to biter void stand():.....codes to stand } in this example there are many method it has all inherited method from class animal and all inherited method of vertebrabrates which is class of animal in short you can add more methods to instances overload or override them also
21st Nov 2016, 5:08 PM
Sandeep Chatterjee
+ 2
ObjName.MethName(prameters);
23rd Nov 2016, 2:44 AM
shalaw ali
shalaw ali - avatar
+ 1
still trying to understand...but thanks man.. appreciate your help..
21st Nov 2016, 5:12 PM
Deepak Tiwari
0
got it now.. thanks mate..
21st Nov 2016, 5:21 PM
Deepak Tiwari
0
There is no problem if there are more methods in class. It is good to have methods. it increases our program readability and anyone can easily be able to understand our program. If you are using methods try to call each and every method.
3rd Feb 2017, 2:40 PM
Ashu Bagul
Ashu Bagul - avatar
- 1
Bhai u can add as many methods as u can depend upon your requirement
26th Nov 2016, 6:34 PM
Sahil Garg
Sahil Garg - avatar