Question
I need some help with some computer science problems. I have the questions and the answers listed below. I also bolded what I think the
I need some help with some computer science problems. I have the questions and the answers listed below. I also bolded what I think the answer is but I just want to double check. If you can also give me a brief explanation, that would be greatly appreciated. Thanks so much in advance!!
1. Given the following code, what is output by the method call, mystery(6 * 8)?
public static void mystery (int x[]) {
System.out.println("A");
}
public static void mystery (int x) {
System.out.println("B");
}
public static void mystery (String x) {
System.out.println("C");
}
A
B (<-bolded, it's a little hard to see)
C (<-bolded, it's a little hard to see)
CA
CB
-------------------------------------------
Which of the following is true about overloaded methods?
Java cannot use a method's return type to tell two overloaded methods apart.
Java cannot use a method's parameters to tell two overloaded methods apart.
You can only overload methods that have parameters.
All overloaded methods must have different names.
None of the above
---------------------------------
Consider the following methods:
public static double doStuff(int a) { return a/2; } public static double doStuff(double val) { return val/10; }
What is output by the following?
System.out.println(doStuff(5) + doStuff(5.0));
2.00.5
2.50.5
22.5
2.5
5
--------------------------------
Consider the following three classes: Clothing, Socks, and Sweater.
Which of the following keywords allows a child class to access the overridden methods in a parent class?
extends
new
super
this
None of the above
-------------------------------------
Which of the following is true about interfaces:
All methods in an interface must be abstract.
A class can only implement one interface.
An interface can have only non-abstract methods.
Can not contain constants but can have variables.
None of the above.
--------------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started