answersLogoWhite

0


Best Answer

false. Two methods can have the same name in Java

User Avatar

Wiki User

โˆ™ 2011-02-15 02:49:23
This answer is:
User Avatar
Study guides

Mixture

1 card

Class

โžก๏ธ
See all cards
4.36
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
22 Reviews

Add your answer:

Earn +20 pts
Q: Two methods cannot have the same name in Java true or false?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Two methods cannot have the same name in Java A True B False?

False. Two methods can have the same name in Java. It is called Method Overloading.


Two methods can not have the same namein java true or false?

Both True and False Two methods can have the same name provided they have a different signature (Parameters, return type) If they have the same signature then two methods cannot have the same name.


The methods cannot have the same name in java true or false?

False. Methods in a class can have the same name as long as they have a different signature. You cannot duplicate method code inside a class but you can always have methods that have the same name but a different signature. Ex: Here I have created two methods in a class that have the same name "sum" but have a different argument types, and return types and hence perfectly allowable in a java class. Public class PolymorphismExample { public int sum(int a, int b){ return a + b; } public double sum (double a, double b){ return a + b; } }


Why java cannot be overloaded?

Java supports method overloading. Several methods in a class (or extension), can use the same method name with different parameters and same result type.


The name of a Java program file must match the name of the class with the extension java A True B False?

True


The name of java program file must match the name of the class with the extension java true or false?

true. Else, it would not compile.


What is difference between the functions and methods?

functions and methods refer to the same thing in Java so they do not have any differences. They are bits of code in java which have a name and can take a bunch of parameters and do a certain function. This code can be invoked by using the name. some people use the name functions and some use the name methods but both refer to the same with respect to the java programming language.


How do you overload static methods in java?

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


The name of a Java program file must match the name of the class with the extension java is true or false?

It must match only when marking a class/interface/enum as public. You may add other classes/interfaces/enums in the file, but they cannot be public. If none of them ar marked as public, then the filename may be any valid java identifier followed by the extension "java"


Why you call acess specifiers as acess modifiers in java?

Java supports both specifiers and modifiers that can dictate the access.An access specifier that can be applied to any identifier like variables, methods and classes but modifiers cannot be applied to every identifier, there are limitations. For example, the modifiers applied to variables cannot be used with classes and similarly with methods also. Modifiers comes just before the class name.


The name of a java program file must match the name of the class with the extensionjavatrue or false?

False.But if you define a class as public class,this class must be written in a java program file that the file's name match the class's name.


What is function overloading in java?

Method overloading is a technique in Java where you can have multiple methods in a class with the same name. These methods will have a different signature. Ex: public int add(int a, int b){} public float add(float a, float b){} The above two methods have the same name but a different signature. This is method overloading.

People also asked