Question: Instructions In the U6_L2 Activity. Three class, write a public static method called hasDuplicates, which has a single parameter of an array of int values.


Instructions In the U6_L2 Activity. Three class, write a public static method called hasDuplicates, which has a single parameter of an array of int values. The method should return a boolean which is true if the parameter array contains the same value more than once, and false otherwise. Use the runner class to test this method: do not add a main method to your code in the U6_L2. Activity Three.java file or it will not be scored correctly. Files STATUS O NOT SUBMITTED U6_L2_Activity_Three.java 1. public class U6_L2_Activity_Three{ 2 3 // Write your hasDuplicates method here 4 5} 6 runner_U6_L2_Activity_T... Files STATUS NOT SUBMITTED SAVE SUBM U6_L2 Activity_Three.java runner_U6_L2_Activity_T... 4 5 6 7 8 1 - import java.util.Scanner; 2 - public class runner_U6_L2_Activity Three 3. public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter array length: "); int len- scan.nextInt(); int[] vals - new int[len]; System.out.println("Enter values:"); for(int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
