Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to output binary search answer?
    primarykey
    data
    text
    <p>I get the error message <code>cannot find symbol, symbol: method books(int[], int)</code> when I try to compile the following code.</p> <p>For further explanation about what I want the code to do, see below the code.</p> <pre><code>public class books { public void main(String[] args) { int searchValue = 0, index; int refNum[] = new int[4]; // the array refNum[0] = 4; //numbers to refer to (aka to find) refNum[1] = 6; refNum[2] = 10; refNum[3] = 12; refNum[4] = 14; int input = Integer.parseInt(enterValue.getText()); //takes user's input for (int x = 0; x &lt; refNum.length; x++) { refNum[x] = input; //Tells refNum value to be } searchValue = input; index = books(refNum, searchValue); //"books" is underlined if (index != -1) { binarySearchField.setText("We found: " + index); } else { binarySearchField.setText("Sorry! Not Found!"); } public static Boolean binarySearch(String [] refNum, int left, int right, String search){ //Boolean code for later } </code></pre> <p>This program uses binary search to find values stored in array after user inputs number, if they match then the item is successfully found. User inputs desired number in 'enterNumber' which is a TextField. Now in my code )which I'm 78% sure will work if it wasn't for this one little thing) there is an all important that is underlined which shouldn't be, (I've commented beside the line to show)</p> <p>Now I had thought I was suppose to put the class name there, but apparently since it is underlined that is not the case. Any ideas on what I should be putting there in it's place? </p> <p>And I apologize for the question may be a bit misleading on what I'm really asking, I just wasn't sure how to word the question.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload