answersLogoWhite

0


Best Answer

method invoking refers to the action in which we call a Java method from within another java method or class.

Method invocation is analogous to a function call in procedural programming.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

The virtual method invocation is a little tricky to explain. But I rather show you an example. Suppose you have a super class like this:

public class Super{

public int number = 1;

public String getColor(){

return "red";

}

}

and now we have a subclass of Super:

public class Sub extends Super{

public int number = 2;

public String getColor(){

return "blue";

}

}

All right, so what is the out put of the next program?

public static void main(String[] args){

Super supersub = new Sub(); //You can do this thanks polymorphism

System.out.println( supersub.getColor() + supersub.number );

}

The output could be "blue2" or maybe "red1". Nooo, the real input is "blue1" and this is due the virtual method invocation. Let me explain it better, you are using a variable of the 'Super' type, but you store there a 'Sub' object instead, the output must be either of the two that I predict before, but the java is capable of track in run time the real method implementation that you are using ("the one that return blue") but it can do the same with your object variable.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

A Method definition in Java needs the below info:

  • Method name
  • Access specifier
  • Return type
  • Arguments

Ex:

public String getName(int empId) {}

here

  • public is the access specifier
  • String is the return type
  • getName is the method name
  • empId is the Argument
This answer is:
User Avatar

User Avatar

Wiki User

13y ago

object.method();

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is mean by method invoking in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is virtual method invocation in java and net?

Virtual method invocation is a term borrowed from C++. It means that methods are invoked polymorphically. Instead of invoking the method in the compile-time type, the method is invoked as its runtime type. In C++, you declare methods virtual that are executed this way.


What is throw exception in java?

The presence of the keywords "throws exception" on a method signature means that, the method may throw an exception whhich it does not handle. It also means that the method that is calling or invoking it has to handle such exceptions. If the calling method does not handle that exception it would have to in turn use the same "throws exception" clause and throw it to its parent method.


What is overridnig method and overlording method in java?

There is no such thing as overlording in Java.


What is the task of the main method in java platform?

It is the method that gets called when a Java application is started.


How nesting of methods is done in java?

No, Java only allows a method to be defined within a class, not within another method.


What is function in java terminology?

In Java, a function is called a "method". In Java as well as other languages, a method is a function defined specifically for one class. In Java, this is the only way to define functions, therefore, all functions are methods.In Java, a function is called a "method". In Java as well as other languages, a method is a function defined specifically for one class. In Java, this is the only way to define functions, therefore, all functions are methods.In Java, a function is called a "method". In Java as well as other languages, a method is a function defined specifically for one class. In Java, this is the only way to define functions, therefore, all functions are methods.In Java, a function is called a "method". In Java as well as other languages, a method is a function defined specifically for one class. In Java, this is the only way to define functions, therefore, all functions are methods.


What is Systenoutprintln?

You probably mean "System.out.println", which is a system method in Java that allows you to print text to the screen.


What is a method in Java?

A Java method is a sequence of statements. It is comparable to a function, subroutine, or procedure in other languages.


What is the purpose of NoMatchException handling method in java?

java exception


Why comparator has equals method?

The Java superclass Object says that all Java objects have an equals method. Thus Comparator has an equals method.


What is the meaning of a method in Java programming?

a method is a variable


What is the return type of finally method in java?

The final and finally keywords have no impact on the return type of a method in Java.