what is overloading in java?

Answer Posted / sivaprasad addepalli

Method Overloading comes into picture when there are two
methods with same name but it must differ in one of the
follwing:

--> Number of arguments.
--> Datatype of arguments.
--> Order of the arguments.

for ex:

class sample
{
public:

void add (int a, int b)
{
}
void add (int a, int b, int c)
{
}
}

In this case the number of arguments are different so it is
method overloading.

Is This Answer Correct ?    20 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between error and exception

5047


What is an immutable class? How to create an immutable class?

547


Explain the hierarchy of java exception classes?

601


What does %4d mean in java?

850


Is there any way to find whether software installed in the system is registered by just providing the .exe file? I have tried the following code but its just displaying the directory structure in the registry. Here the code : package com.msi.intaller; import java.util.Iterator; import ca.beq.util.win32.registry.RegistryKey; import ca.beq.util.win32.registry.RootKey; public class RegistryFinder { public static void main(String... args) throws Exception { RegistryKey.initialize(RegistryFinder.class.getResource("jRe gistryKey.dll").getFile()); RegistryKey key = new RegistryKey(RootKey.HKLM, "Software\\ODBC"); for (Iterator subkeys = key.subkeys(); subkeys.hasNext();) { RegistryKey subkey = subkeys.next(); System.out.println(subkey.getName()); // You need to check here if there's anything which matches "Mozilla FireFox". } } }

1357






What is binary tree in java?

538


What is the collections api?

579


What is a treeset class?

564


Define nashorn in java8.

570


What technique is carried out to find out if a particular string is empty?

582


What is palindrome in java?

562


Explain the difference between static and dynamic binding in java?

549


how is final different from finally and finalize in java?

612


Explain when we should make an instance variable private.

621


What is a treemap in java?

545