(Method Overloading) Given the following methods, write down the printed output of the method calls: (5 points) public static void doSomething(String x) { System.out.println("A"); } public static void doSomething(int x) { System.out.println("B"); } public static void doSomething(double x) { System.out.println("C"); } public static void doSomething(String x, int y) { System.out.println("D"); } public static void doSomething(int x, String y) { System.out.println("E"); } public static void doSomething(double x, int y) { System.out.println("F"); } Method calls 1. doSomething(5); 2. doSomething (5.2, 9); 3. doSomething(3, "Hello"); 4. doSomething("Able", 8); 5. doSomething ("Alfred"); 6. doSomething (3.6); 7. doSomething("World");
(Method Overloading) Given the following methods, write down the printed output of the
method calls: (5 points)
public static void doSomething(String x)
{
System.out.println("A");
}
public static void doSomething(int x)
{
System.out.println("B");
}
public static void doSomething(double x)
{
System.out.println("C");
}
public static void doSomething(String x, int y)
{
System.out.println("D");
}
public static void doSomething(int x, String y)
{
System.out.println("E");
}
public static void doSomething(double x, int y)
{
System.out.println("F");
}
Method calls
1. doSomething(5);
2. doSomething (5.2, 9);
3. doSomething(3, "Hello");
4. doSomething("Able", 8);
5. doSomething ("Alfred");
6. doSomething (3.6);
7. doSomething("World");
Trending now
This is a popular solution!
Step by step
Solved in 3 steps