Question
class overload
{
int x;
int y;
void add(int a)
{
x = a + 1;
}
void add(int a , int b)
{
x = a + 2;
}
}
class Overload_methods
{
public static void main(String args[])
{
overload obj = new overload();
int a = 0;
obj.add(6, 7);
System.out.println(obj.x);
}
}
a.
6
b.
7
c.
8
d.
9
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. Which of these is used to access a member of class before object of that class is created?
View solution
Q. Which of these is used as a default for a member of a class if no access specifier is used for it?
View solution
Q. Which of the following statements are incorrect?
View solution
Q. Which one of the following is not an access modifier?
View solution
Q. All the variables of class should be ideally declared as?
View solution
Q. Which of the following modifier means a particular variable cannot be accessed within the package?
View solution
Q. How can a protected modifier be accessed?
View solution
Q. What happens if constructor of class A is made private?
View solution
Q. All the variables of interface should be?
View solution
Q. What is true of final class?
View solution
Q. How many copies of static and class variables are created when 10 objects are created of a class?
View solution
Q. Can a class be declared with a protected modifier.
View solution
Q. Which is the modifier when there is none mentioned explicitly?
View solution
Q. Arrays in Java are implemented as?
View solution
Q. Which of these keywords is used to prevent content of a variable from being modified?
View solution
Q. Which of these cannot be declared static?
View solution
Q. Which of these methods must be made static?
View solution
Q. String in Java is a?
View solution
Q. Which of these method of String class is used to obtain character at specified index?
View solution
Q. Which of these keywords is used to refer to member of base class from a subclass?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!