subject

Write a recursive, boolean -valued method named search that accepts an integer array , the number of elements in the array , and an integer (in that order), and returns whether the integer is present as an element in the array . Searching for a particular value in an array can be performed in the following recursive manner: If the array has no elements , the value is not there.
Compare the first element of the array to the value , if they're equal , the value is there; other search for the value in the rest of the array .
My program is..
public boolean search(int arr[],int n, int m){
if(n==0){
return false;
}
if(arr[n]==m){
return true;
}
n=n-1;
return search(arr[],n-1,m);
}
but I recieve a compiler error CTest. java:10: error: '.class' expected
what am I doing wrong?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:10
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
question
Computers and Technology, 23.06.2019 14:00
What is html ? give a small description about html
Answers: 2
question
Computers and Technology, 23.06.2019 16:00
Does read theory have answers keys ?
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
You know the right answer?
Write a recursive, boolean -valued method named search that accepts an integer array , the number of...
Questions
question
Biology, 21.06.2021 14:50
question
Chemistry, 21.06.2021 14:50
question
Biology, 21.06.2021 14:50
question
Business, 21.06.2021 14:50
question
Mathematics, 21.06.2021 14:50
question
Mathematics, 21.06.2021 14:50
question
Biology, 21.06.2021 14:50
question
History, 21.06.2021 15:00
Questions on the website: 13722362