Question
Please answer quickly 1- Given the following code snippet: default E getMaxObject(HashMap objects) { E max=objects.get(0); for(HashMap.Entry entries: objects.entrySet()) { if(entries.getValue().compareTo(max) > 0) max= entries.getValue();
Please answer quickly
1-
Given the following code snippet:
default
E max=objects.get(0);
for(HashMap.Entry
{
if(entries.getValue().compareTo(max) > 0) max= entries.getValue();
}
return max;
}
return max;
}
a.
The class to which the object E belong must be of type Double
b.
All of these
c.
The class to which the object E belongs must implement Comparable interface
d.
The class to which the object E belongs must implement Comparable
2-
Choose the correct signature for the below method. It must take a HashMap
default ........................................................................ getMaxObject(........................... objects)
{
E max=objects.get(0);
for(HashMap.Entry
{
if(entries.getValue().compareTo(max) > 0) max= entries.getValue();
}
return max;
}
a.
default
b.
default
c.
default
d.
None of these
3-
Java does not allow implementing multiple interfaces through a single class declaration statement such as:
public class Student implements Comparable, Cloneable{
//code goes here
}
Select one:
True
False
4-
Final Methods: are methods that are defined er class.
Select one:
True
False
5-
The Java programming language always uses call by value when passing arguments to methods
Select one:
True
False
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