answersLogoWhite

0

Just create two methods with the same name, but with different types or numbers of parameters.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Can you overload static methods in Java?

Yes you can overload the static method. But it should be avoided because memory to static methods are allocated at the time of class load.....so memory will be wasted if we don't use that methods. Whereas non-static method memory allocation depends on Object


What does the 'this' reference do in Java?

Represents the current object (not usable in static methods).


How do you access the static variable and static methods of a class?

In java we access static variables and static methods without creating objects. i.e.,we can access directly by using classname we can also access static variables and static methods by using objects which are created by using class where the static variables and static methods are available


Can you inherit static method in java?

Yes. While it is sometimes considered bad style to override static methods, you can treat them like any non-static methods when it comes to inheritance topics.


Can a method be static and synchronized?

Yes. In Java methods can be static and synchronized. Static methods access other static members in the class. Static in case of inheritance are treated as non - static. Synchronized methods are those which have dedicated thread attached to it and no other can access until currrent thread leaves the control from it.


When you overload a Java method you write multiple methods?

Yes. The definition of function overloading is multiple methods with the same name, but different numbers of arguments and return types. static int getArea(int height, int width) { return height * width; } static double getArea(double height, double width) { return height * width; }


Which one executed first static block or static methods in java?

Static Blocks are always executed first. A static block is executed when your class is charged but a static method is executed only when is called, therefor first the class is charged and then is executed a method.


Static membors partispating Overwriting in java?

Static membors partispating in Overwriting in java?


What is Static method in programming?

A static method in java is also named a class method, because it does not need an instance (of his class) to be invoked. Static methods can't use instance variables (non static variables) or use the keywords 'this'. These methods receive all the information they need to complete his task from his parameters


Difference between procedure and function in C or C plus plus or Java language?

In C there are functions only, In Java methodsonly (static methods as well), in C++ both.


Is it possible to define a java static method inside a main method?

Because, the main method is the starting point of the java program and if we need an object of that class even before the main can be invoked, it is not possible. Hence it is declared static so that the JVM Can acess the main method without having to instantiate that particular class


What is static java most commonly used for?

Static java method is the same as a static variable. They belong to a class and not an object of that class. If a method needs to be in a class, but not tied to an object, then one uses static java.