+ 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...
8 Answers
+ 5
yes you can call all methods same way
object.methodtobecalled(parameters);
dog.run()
+ 4
Object name.method name();
+ 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
+ 2
ObjName.MethName(prameters);
+ 1
still trying to understand...but thanks man.. appreciate your help..
0
got it now.. thanks mate..
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.
- 1
Bhai u can add as many methods as u can depend upon your requirement