Page 1 of 1
Add a public method equals(ClassA otherClass) to class classA that returns the value true if (i) this object and otherCl
Posted: Fri Jul 01, 2022 5:53 am
by answerhappygod

- Add A Public Method Equals Classa Otherclass To Class Classa That Returns The Value True If I This Object And Othercl 1 (15.58 KiB) Viewed 46 times
Add a public method equals(ClassA otherClass)to class classA that returns the value true if (i)this object and otherClass havethe same value in variable numItems and (ii) botharrItems arrays are null or both store the samevalues and in the same order in the firstnumItems entries; the method returns the valuefalse otherwise. Do not try to access values from variablearrItems if arrItems is null.
1 public class ClassA { o in it WNHO OVOGA WNH 2 3 4 5 61 7 8 9 10 11 12 13 14 15 } 16 private final int SIZE_ARRAY public int numItems; public int[] arrItems; public ClassA(int n, int[] arr) { numItems = n; arrItems = arr; } 5; public ClassA() { numItems = 0; arrItems = new int[SIZE ARRAY]; }