Trying to understand a java function parameters -
My teacher has asked a question and here it is:
Write a program that uses input words Say in an array. When a word is entered twice, then the program will stop using the following method:
Stable Boolean search word (string s, string [] arr) // If true, in AR Is found, wrong otherwise When the input is complete, then your program will output to the list in the ordered order.
I'm a little lost on this parameter of the function
string [] arr what type of parameter input is searching for Here's my code.
public static zero main (string [] args) {c = new console (); String word [] = new string [50000]; {C.print ("Input word:") for (Int i = 0; i & gt; -1; i ++); Word [i] = c.readLine (); Keywords ("apple", what goes here?); }} Fixed Boolean keyword (string s, string [] term) {return false; } At any time, I try to insert some sort of array or value in the spot, such as findWord ("hello", the word [ 0]) Or whatever I get the following error:
No applicable overload method named "findWord" was found in type E3_Q5 Overloaded version "Boolean searchword (java.lang.String s, java.lang.String [] word); Instead? What does this mean? Why does he want to keep me there?
string [] arr context string For an array. Using findWord ("hello", word [0]) does not work because you only provide a string the word [0] When the method or function is called word or whole array to words . findWord ("apple", word); Note: You will need to modify your method keyword (string s, string [] term) because it is always always false will return. {String (word of the word): {if (s.equals (word)) returned true;} return false;} / Code>
Comments
Post a Comment