Question: in java TASK: Create a class called MyArray with the following properties: It should have a private instance variable of type int[] called elements to

in java TASK: Create a class called MyArray with the following properties:in java

TASK: Create a class called MyArray with the following properties: It should have a private instance variable of type int[] called elements to store its elements It must have a public constructor that has an int parameter called size followed by an int parameter called defaultVal, and it should initialize elements to be an int[] of length size in which every element is defaultVal It must have a public constructor that has an int parameter called size, and it should initialize elements to be an int[] of length size in which every element is o It must have a public no-parameter constructor, and it should initialize elements to be an int[] of length 10 in which every element is 0 It must have a public constructor that has an int[] parameter called vals, and it should set elements to be a copy of vals It must have a public no-parameter method called getElements that returns a copy of elements NOTE: Ignore the "Sample Input:" and "Sample Output:" sections immediately below this. They are always shown by Stepik, even if they're not used. The "CORRECT" message is something that is being used behind-the-scenes in the grading system. Sample Input: Sample Output: CORRECT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!