Question
I need some help doing this java program. This is the MyArrayList code, and below is everything needed to run it. /* * To change
I need some help doing this java program.
This is the MyArrayList code, and below is everything needed to run it.
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package collection;
/* * @This program clones an array * * */
public class MyArrayList implements Cloneable{ public Object[] obj; public int maxsize = 100,initialsize = 0; public MyArrayList(){ obj = new Object[maxsize]; } public void append(Object element){ if(initialsize index;i--){ obj[i] = obj[i-1]; } obj[index] = element; } public boolean isEmpty(){ if(initialsize == 0) return true; return false; } public void removedAt(int index){ for(int i=index;i Lab 2 Program package lab; import collection.MyArrayList; /* * @This program clones an array * @author jgemerick0 * @version 2020.20.2 */ public class Lab2{ public static void test(String[] cmd) throws CloneNotSupportedException { MyArrayList list = new MyArrayList(); list.append(0); list.append(2); int one = 0,two =1; for(int i=0;i }. This the main to class. package main; import lab.Lab2; /** * @This program prints a clone of another array * @author jgemerick0 * * @version 2020.20.2 */ public class Main { public static void main(String[] args) throws CloneNotSupportedException { Lab2.test(args); } }
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