Create a main method that takes input as array, call haveThree (described below) method by passing the array as parameters

Create a main method that takes input as array, call haveThree (described below) method by passing the array as parameters and print result from haveThree method. Create a method with the following header:public static boolean haveThree(int[] nums)Define it as follows:Given an array of ints, return true if the value 3 appears in the array exactly 3 times, and no 3’s are next to each other. haveThree([3, 1, 3, 1, 3]) → truehaveThree([3, 1, 3, 3]) → false haveThree([3, 4, 3, 3, 4]) → false


Leave a Reply

Your email address will not be published. Required fields are marked *