Question
class overload
{
int x;
double y;
void add(int a , int b)
{
x = a + b;
}
void add(double c , double d)
{
y = c + d;
}
overload()
{
this.x = 0;
this.y = 0;
}
}
class Overload_methods
{
public static void main(String args[])
{
overload obj = new overload();
int a = 2;
double b = 3.2;
obj.add(a, a);
obj.add(b, b);
System.out.println(obj.x + " " + obj.y);
}
}
a.
6 6
b.
6.4 6.4
c.
6.4 6
d.
4 6.4
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 access specifier must be used for class so that it can be inherited by another subclass?
View solution
Q. Which is true about an anonymous inner class?
View solution
Q. Which is true about a method-local inner class?
View solution
Q. Which statement is true about a static nested class?
View solution
Q. Which constructs an anonymous inner class instance?
View solution
Q. What allows the programmer to destroy an object x?
View solution
Q. Which statement is true?
View solution
Q. Which statement is true?
View solution
Q. Which statement is true?
View solution
Q. Which statement is true?
View solution
Q. A class which is declared with the ________ keyword is known as an abstract class in Java.
View solution
Q. Abstract class can have constructors and static methods?
View solution
Q. What is the syntax of abstract class in java?
View solution
Q. A method which is declared as abstract and does not have implementation is known as an _____________?
View solution
Q. An abstract class can have a data member, abstract method, method body (non-abstract method), constructor, and even main() method.
View solution
Q. Java is a ___ programming language.
View solution
Q. In Java programming language, the code is placed inside ___.
View solution
Q. Properties are implemented using ___ in Java.
View solution
Q. A Class in Java is like a ____.
View solution
Q. Which is the file extension used for a public Java class source code?
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!