Knowee
Questions
Features
Study Tools

You are asked to create a method which should satisfy the following requirements.Method should be in package access level. It should take a double array. It should return the position index of the max value from the double array. Name of the method should be “max”. And it shouldn’t be an instance Method.Which is the correct method signature?*double[]max (int c)public double max(double []c)static int max (double []c)int max(double []c)private static double[] max(int c)

Question

You are asked to create a method which should satisfy the following requirements.Method should be in package access level. It should take a double array. It should return the position index of the max value from the double array. Name of the method should be “max”. And it shouldn’t be an instance Method.Which is the correct method signature?*double[]max (int c)public double max(double []c)static int max (double []c)int max(double []c)private static double[] max(int c)

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct method signature is:

static int max (double []c)

This method is static, meaning it's not an instance method. It's in package access level because it doesn't have a public, private, or protected modifier. It takes a double array as an argument and returns an integer, which represents the position index of the max value in the double array. The name of the method is "max".

Similar Questions

Which of the following method headers could be used for a method that finds the largest value in an array of integers that is smaller than a given value?  Mark ALL that apply.Group of answer choicespublic static int maxSmallerThan(int max, int[ ] arr)public static int maxSmallerThan(int[ ] arr, int val)public static int[ ] maxSmallerThan(int max, int answer)public static void maxSmallerThan(int[ ] arr, int max, int answer)

Question39Max. score: 2.00In object-oriented programming, which of these concepts is represented in the following two code statements:double max2 = MathUtil.max(10.34, 2.89);int max1 = MathUtil.max(10, 23); Method overloadingInheritenceMethod overridingAbstraction

a) Write java code statements to accomplish the following. [5 Marks]i) declares following variables: ‘Max and Minii) Initializes the two variables above with values 5 and 3 respectivelyiii) Determines largest variable amongst the two aboveiv) Prints results of the largest variable:v) Declare and initialize array

What is the output of the following code?public class Test{ public static void main(String args[]){ double[] myList = {1, 5, 5, 5, 5, 1}; double max = myList[0]; int indexOfMax = 0; for(int i = 1; i < myList.length; i++){ if(myList[i] > max){ max = myList[i]; indexOfMax = i; }

Create a class A with data member to store a array of N integers. Define a default constructor to read the array. Define a member function show() that will print the integer array.Create a derived class B with a member function show() that will print the maximum value in the integer array.Make the member finction show() in base class as virtual.Create  objects and pointers to access the member functions.Sample Input5 (Read N)1297343Sample Output34

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.