Answer:
The required code is given below:
Explanation:
public class Minimum {
public static Comparable min(Comparable[] values) {
if (values == null || values.length == 0) {
return null;
} else {
Comparable minValue = values[0];
for (int i = 0; i < values.length; i++) {
if (values[i].compareTo(minValue) < 0) {
minValue = values[i];
}
}
return minValue;
}
}
}
Answer:
Yes, we need a modern programming language to support all paradigms. Hence, OOPS will remain the doctrine of selection, but other paradigms like functional oriented programming language will also exist, and this is like in Python.
Reasons are:
1. OOPS is not always the correct option, sometimes Functional oriented programming languages can also be.
2. And in some cases, a procedural programming language can be a better option. Hence, it's better to have all paradigms being supported rather than one, like in the case of Python.
Explanation:
Please check answer.
Answer: II and III only
The first code will print starting with the second variable in the array. So it will start with array[1] instead of starting with array[0]
The second code will start from array[0] as the variable i is 0. It will print the first value in the array before proceeding to increment the value of i.
The third code will also start from array{0] as the program will check for the first value of a before proceeding to the next one.
An example would be if we were to define the array as:
int[] a = {1,2,3,4,5};
1st Code Output:
2
3
4
5
2nd Code Output:
1
2
3
4
5
3rd code Output:
1
2
3
4
5
Always remember that arrays will always begin from 0.
The answer to this is similar documentaries on youtube!! Hope i helped