Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA PROGRAM Write a method named intersection() that takes two integer arrays (A, B) as arguments. Initialize an array C with N, -1 values, where
JAVA PROGRAM
Write a method named intersection() that takes two integer arrays (A, B) as arguments. Initialize an array C with N, -1 values, where N is the length of the A or B array. If an integer c, is found in both array A and B, store this integer at the first available index (CTindex] equals 1) within array C. Return array C to your main method and then print out its elements. Test your method on the following arrays: Test #3 [1, 2,3, 4, 5 [6, 7, 8, 9, 10] Test #1 Test #2 A 12, 7, 3, 5, 8] B- [4, 5, 2, 6, 7] C-[, 2,3, 4, 5]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